<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>Navo Portable Library: navo/port/bits.h源文件</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body onload='searchBox.OnSelectItem(0);'>
<!-- 制作者 Doxygen 1.7.3 -->
<script type="text/javascript"><!--
var searchBox = new SearchBox("searchBox", "search",false,'搜索');
--></script>
<div id="top">
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td style="padding-left: 0.5em;">
   <div id="projectname">Navo Portable Library&#160;<span id="projectnumber">Ver 1.0.20120827</span></div>
   <div id="projectbrief">Provides generic platform independent facilities.</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>首页</span></a></li>
      <li><a href="modules.html"><span>模块</span></a></li>
      <li><a href="annotated.html"><span>数据结构</span></a></li>
      <li class="current"><a href="files.html"><span>文件</span></a></li>
      <li id="searchli">
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="搜索" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>文件列表</span></a></li>
      <li><a href="globals.html"><span>全局定义</span></a></li>
    </ul>
  </div>
<div class="header">
  <div class="headertitle">
<h1>navo/port/bits.h</h1>  </div>
</div>
<div class="contents">
<a href="bits_8h.html">浏览该文件的文档。</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */</span>
<a name="l00011"></a>00011 <span class="preprocessor">#ifdef _MSC_VER</span>
<a name="l00012"></a>00012 <span class="preprocessor"></span><span class="preprocessor">#pragma once</span>
<a name="l00013"></a>00013 <span class="preprocessor"></span><span class="preprocessor">#endif </span><span class="comment">/* #ifdef _MSC_VER */</span>
<a name="l00014"></a>00014 
<a name="l00015"></a>00015 <span class="preprocessor">#ifndef __NV_BITS__</span>
<a name="l00016"></a>00016 <span class="preprocessor"></span><span class="preprocessor">#define __NV_BITS__</span>
<a name="l00017"></a>00017 <span class="preprocessor"></span>
<a name="l00018"></a>00018 <span class="preprocessor">#include &quot;<a class="code" href="cdef_8h.html" title="Definitions and declarations for common constants, types, variables.">cdef.h</a>&quot;</span>
<a name="l00019"></a>00019 <span class="preprocessor">#include &quot;<a class="code" href="integer_8h.html" title="Provides standard integer types.">integer.h</a>&quot;</span>
<a name="l00020"></a>00020 
<a name="l00021"></a>00021 <span class="comment">/* Microsoft intrinsic functions */</span>
<a name="l00022"></a>00022 <span class="preprocessor">#if !defined(__GNUC__) &amp;&amp; defined(_MSC_VER) &amp;&amp; _MSC_VER &gt;= 1400</span>
<a name="l00023"></a>00023 <span class="preprocessor"></span><span class="preprocessor">#ifdef INT64_SUPPORT</span>
<a name="l00024"></a>00024 <span class="preprocessor"></span><span class="preprocessor">#pragma intrinsic(_BitScanForward, _BitScanForward64)</span>
<a name="l00025"></a>00025 <span class="preprocessor"></span><span class="preprocessor">#pragma intrinsic(_BitScanReverse, _BitScanReverse64)</span>
<a name="l00026"></a>00026 <span class="preprocessor"></span><span class="preprocessor">#else</span>
<a name="l00027"></a>00027 <span class="preprocessor"></span><span class="preprocessor">#pragma intrinsic(_BitScanForward, _BitScanReverse)</span>
<a name="l00028"></a>00028 <span class="preprocessor"></span><span class="preprocessor">#endif </span><span class="comment">/* #ifdef INT64_SUPPORT */</span>
<a name="l00029"></a>00029 <span class="preprocessor">#if _MSC_VER &gt;= 1500</span>
<a name="l00030"></a>00030 <span class="preprocessor"></span><span class="preprocessor">#ifdef INT64_SUPPORT</span>
<a name="l00031"></a>00031 <span class="preprocessor"></span><span class="preprocessor">#pragma intrinsic(__lzcnt, __lzcnt64)</span>
<a name="l00032"></a>00032 <span class="preprocessor"></span><span class="preprocessor">#else</span>
<a name="l00033"></a>00033 <span class="preprocessor"></span><span class="preprocessor">#pragma intrinsic(__lzcnt)</span>
<a name="l00034"></a>00034 <span class="preprocessor"></span><span class="preprocessor">#endif </span><span class="comment">/* #ifdef INT64_SUPPORT */</span>
<a name="l00035"></a>00035 <span class="preprocessor">#endif </span><span class="comment">/* #if _MSC_VER &gt;= 1500 */</span>
<a name="l00036"></a>00036 <span class="preprocessor">#endif </span><span class="comment">/* #if !defined(__GNUC__) &amp;&amp; defined(_MSC_VER) &amp;&amp; _MSC_VER &gt;= 1400 */</span>
<a name="l00037"></a>00037 
<a name="l00038"></a>00038 <span class="preprocessor">#ifdef __cplusplus</span>
<a name="l00039"></a>00039 <span class="preprocessor"></span><span class="keyword">extern</span> <span class="stringliteral">&quot;C&quot;</span> {
<a name="l00040"></a>00040 <span class="preprocessor">#endif </span><span class="comment">/* #ifdef __cplusplus */</span>
<a name="l00041"></a>00041 
<a name="l00048"></a>00048 <span class="preprocessor">#define __BIT8C_L0  0x01</span>
<a name="l00049"></a>00049 <span class="preprocessor"></span><span class="preprocessor">#define __BIT8C_L1  0x02</span>
<a name="l00050"></a>00050 <span class="preprocessor"></span><span class="preprocessor">#define __BIT8C_L2  0x04</span>
<a name="l00051"></a>00051 <span class="preprocessor"></span><span class="preprocessor">#define __BIT8C_L3  0x08</span>
<a name="l00052"></a>00052 <span class="preprocessor"></span><span class="preprocessor">#define __BIT8C_L4  0x10</span>
<a name="l00053"></a>00053 <span class="preprocessor"></span><span class="preprocessor">#define __BIT8C_L5  0x20</span>
<a name="l00054"></a>00054 <span class="preprocessor"></span><span class="preprocessor">#define __BIT8C_L6  0x40</span>
<a name="l00055"></a>00055 <span class="preprocessor"></span><span class="preprocessor">#define __BIT8C_L7  0x80</span>
<a name="l00056"></a>00056 <span class="preprocessor"></span>
<a name="l00057"></a>00057 <span class="preprocessor">#define __BIT16C_L0     0x0001</span>
<a name="l00058"></a>00058 <span class="preprocessor"></span><span class="preprocessor">#define __BIT16C_L1     0x0002</span>
<a name="l00059"></a>00059 <span class="preprocessor"></span><span class="preprocessor">#define __BIT16C_L2     0x0004</span>
<a name="l00060"></a>00060 <span class="preprocessor"></span><span class="preprocessor">#define __BIT16C_L3     0x0008</span>
<a name="l00061"></a>00061 <span class="preprocessor"></span><span class="preprocessor">#define __BIT16C_L4     0x0010</span>
<a name="l00062"></a>00062 <span class="preprocessor"></span><span class="preprocessor">#define __BIT16C_L5     0x0020</span>
<a name="l00063"></a>00063 <span class="preprocessor"></span><span class="preprocessor">#define __BIT16C_L6     0x0040</span>
<a name="l00064"></a>00064 <span class="preprocessor"></span><span class="preprocessor">#define __BIT16C_L7     0x0080</span>
<a name="l00065"></a>00065 <span class="preprocessor"></span><span class="preprocessor">#define __BIT16C_L8     0x0100</span>
<a name="l00066"></a>00066 <span class="preprocessor"></span><span class="preprocessor">#define __BIT16C_L9     0x0200</span>
<a name="l00067"></a>00067 <span class="preprocessor"></span><span class="preprocessor">#define __BIT16C_L10    0x0400</span>
<a name="l00068"></a>00068 <span class="preprocessor"></span><span class="preprocessor">#define __BIT16C_L11    0x0800</span>
<a name="l00069"></a>00069 <span class="preprocessor"></span><span class="preprocessor">#define __BIT16C_L12    0x1000</span>
<a name="l00070"></a>00070 <span class="preprocessor"></span><span class="preprocessor">#define __BIT16C_L13    0x2000</span>
<a name="l00071"></a>00071 <span class="preprocessor"></span><span class="preprocessor">#define __BIT16C_L14    0x4000</span>
<a name="l00072"></a>00072 <span class="preprocessor"></span><span class="preprocessor">#define __BIT16C_L15    0x8000</span>
<a name="l00073"></a>00073 <span class="preprocessor"></span>
<a name="l00074"></a>00074 <span class="preprocessor">#define __BIT32C_L0     0x00000001UL</span>
<a name="l00075"></a>00075 <span class="preprocessor"></span><span class="preprocessor">#define __BIT32C_L1     0x00000002UL</span>
<a name="l00076"></a>00076 <span class="preprocessor"></span><span class="preprocessor">#define __BIT32C_L2     0x00000004UL</span>
<a name="l00077"></a>00077 <span class="preprocessor"></span><span class="preprocessor">#define __BIT32C_L3     0x00000008UL</span>
<a name="l00078"></a>00078 <span class="preprocessor"></span><span class="preprocessor">#define __BIT32C_L4     0x00000010UL</span>
<a name="l00079"></a>00079 <span class="preprocessor"></span><span class="preprocessor">#define __BIT32C_L5     0x00000020UL</span>
<a name="l00080"></a>00080 <span class="preprocessor"></span><span class="preprocessor">#define __BIT32C_L6     0x00000040UL</span>
<a name="l00081"></a>00081 <span class="preprocessor"></span><span class="preprocessor">#define __BIT32C_L7     0x00000080UL</span>
<a name="l00082"></a>00082 <span class="preprocessor"></span><span class="preprocessor">#define __BIT32C_L8     0x00000100UL</span>
<a name="l00083"></a>00083 <span class="preprocessor"></span><span class="preprocessor">#define __BIT32C_L9     0x00000200UL</span>
<a name="l00084"></a>00084 <span class="preprocessor"></span><span class="preprocessor">#define __BIT32C_L10    0x00000400UL</span>
<a name="l00085"></a>00085 <span class="preprocessor"></span><span class="preprocessor">#define __BIT32C_L11    0x00000800UL</span>
<a name="l00086"></a>00086 <span class="preprocessor"></span><span class="preprocessor">#define __BIT32C_L12    0x00001000UL</span>
<a name="l00087"></a>00087 <span class="preprocessor"></span><span class="preprocessor">#define __BIT32C_L13    0x00002000UL</span>
<a name="l00088"></a>00088 <span class="preprocessor"></span><span class="preprocessor">#define __BIT32C_L14    0x00004000UL</span>
<a name="l00089"></a>00089 <span class="preprocessor"></span><span class="preprocessor">#define __BIT32C_L15    0x00008000UL</span>
<a name="l00090"></a>00090 <span class="preprocessor"></span><span class="preprocessor">#define __BIT32C_L16    0x00010000UL</span>
<a name="l00091"></a>00091 <span class="preprocessor"></span><span class="preprocessor">#define __BIT32C_L17    0x00020000UL</span>
<a name="l00092"></a>00092 <span class="preprocessor"></span><span class="preprocessor">#define __BIT32C_L18    0x00040000UL</span>
<a name="l00093"></a>00093 <span class="preprocessor"></span><span class="preprocessor">#define __BIT32C_L19    0x00080000UL</span>
<a name="l00094"></a>00094 <span class="preprocessor"></span><span class="preprocessor">#define __BIT32C_L20    0x00100000UL</span>
<a name="l00095"></a>00095 <span class="preprocessor"></span><span class="preprocessor">#define __BIT32C_L21    0x00200000UL</span>
<a name="l00096"></a>00096 <span class="preprocessor"></span><span class="preprocessor">#define __BIT32C_L22    0x00400000UL</span>
<a name="l00097"></a>00097 <span class="preprocessor"></span><span class="preprocessor">#define __BIT32C_L23    0x00800000UL</span>
<a name="l00098"></a>00098 <span class="preprocessor"></span><span class="preprocessor">#define __BIT32C_L24    0x01000000UL</span>
<a name="l00099"></a>00099 <span class="preprocessor"></span><span class="preprocessor">#define __BIT32C_L25    0x02000000UL</span>
<a name="l00100"></a>00100 <span class="preprocessor"></span><span class="preprocessor">#define __BIT32C_L26    0x04000000UL</span>
<a name="l00101"></a>00101 <span class="preprocessor"></span><span class="preprocessor">#define __BIT32C_L27    0x08000000UL</span>
<a name="l00102"></a>00102 <span class="preprocessor"></span><span class="preprocessor">#define __BIT32C_L28    0x10000000UL</span>
<a name="l00103"></a>00103 <span class="preprocessor"></span><span class="preprocessor">#define __BIT32C_L29    0x20000000UL</span>
<a name="l00104"></a>00104 <span class="preprocessor"></span><span class="preprocessor">#define __BIT32C_L30    0x40000000UL</span>
<a name="l00105"></a>00105 <span class="preprocessor"></span><span class="preprocessor">#define __BIT32C_L31    0x80000000UL</span>
<a name="l00106"></a>00106 <span class="preprocessor"></span>
<a name="l00114"></a><a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#ga2dbcdf4a2547d24ba3f90d7271e4fa18">00114</a> <span class="preprocessor">#define __bitmask_c(b, i) make_id4(__BIT, b, C_L, i)</span>
<a name="l00115"></a>00115 <span class="preprocessor"></span>
<a name="l00136"></a><a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#gae9d9c7ace4d4c4747176bf22411c7917">00136</a> <span class="preprocessor">#define __getb_c(b, x, i) \</span>
<a name="l00137"></a>00137 <span class="preprocessor">    (!!(((UINT_TYPE(b))(x)) &amp; __bitmask_c(b, i)))</span>
<a name="l00138"></a>00138 <span class="preprocessor"></span>
<a name="l00158"></a><a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#gae7faee0978500d94c8c07ba4d3fc850f">00158</a> <span class="preprocessor">#define __setb_c(b, x, i) \</span>
<a name="l00159"></a>00159 <span class="preprocessor">    (((UINT_TYPE(b))(x)) | __bitmask_c(b, i)))</span>
<a name="l00160"></a>00160 <span class="preprocessor"></span>
<a name="l00180"></a><a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#ga270dc6507e8949dfe64397fd0e22a680">00180</a> <span class="preprocessor">#define __clrb_c(b, x, i) \</span>
<a name="l00181"></a>00181 <span class="preprocessor">    (((UINT_TYPE(b))(x)) &amp; (~ __bitmask_c(b, i))))</span>
<a name="l00182"></a>00182 <span class="preprocessor"></span>
<a name="l00202"></a><a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#gab85a25f701839cc695006c0c12b271a3">00202</a> <span class="preprocessor">#define __setb_cr(b, x, i) \</span>
<a name="l00203"></a>00203 <span class="preprocessor">    (((UINT_TYPE(b))(x)) |= __bitmask_c(b, i)))</span>
<a name="l00204"></a>00204 <span class="preprocessor"></span>
<a name="l00224"></a><a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#ga527d34b62596587b21ba161173d84d45">00224</a> <span class="preprocessor">#define __clrb_cr(b, x, i) \</span>
<a name="l00225"></a>00225 <span class="preprocessor">    (((UINT_TYPE(b))(x)) &amp;= (~ __bitmask_c(b, i))))</span>
<a name="l00226"></a>00226 <span class="preprocessor"></span>
<a name="l00247"></a><a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#gac97f627877cbd46980bedcd14e36417a">00247</a> <span class="preprocessor">#define __getb_cp(b, p, i) \</span>
<a name="l00248"></a>00248 <span class="preprocessor">    (!!((*(UINT_TYPE(b) *)(p)) &amp; __bitmask_c(b, i)))</span>
<a name="l00249"></a>00249 <span class="preprocessor"></span>
<a name="l00269"></a><a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#gacb2936fd14861c06e770cf2fb4e75f58">00269</a> <span class="preprocessor">#define __setb_cp(b, p, i) \</span>
<a name="l00270"></a>00270 <span class="preprocessor">    ((*(UINT_TYPE(b) *)(p)) | __bitmask_c(b, i)))</span>
<a name="l00271"></a>00271 <span class="preprocessor"></span>
<a name="l00291"></a><a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#ga65ecf1ec5e9fecd065154e789362b8c8">00291</a> <span class="preprocessor">#define __clrb_cp(b, p, i) \</span>
<a name="l00292"></a>00292 <span class="preprocessor">    ((*(UINT_TYPE(b) *)(p)) &amp; (~ __bitmask_c(b, i))))</span>
<a name="l00293"></a>00293 <span class="preprocessor"></span>
<a name="l00313"></a><a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#ga7e8dcebc8fd5324ac02131867daa1842">00313</a> <span class="preprocessor">#define __setb_cs(b, p, i) \</span>
<a name="l00314"></a>00314 <span class="preprocessor">    (*((UINT_TYPE(b) *)(p)) |= __bitmask_c(b, i)))</span>
<a name="l00315"></a>00315 <span class="preprocessor"></span>
<a name="l00335"></a><a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#gab86e5021a3c54250c2773a7ededcdb49">00335</a> <span class="preprocessor">#define __clrb_cs(b, p, i) \</span>
<a name="l00336"></a>00336 <span class="preprocessor">    (*((UINT_TYPE(b) *)(p)) &amp;= (~ __bitmask_c(b, i))))</span>
<a name="l00337"></a>00337 <span class="preprocessor"></span>
<a name="l00347"></a><a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#ga2289662f108de59ef47008c500b459a9">00347</a> <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">int</span> <a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#ga2289662f108de59ef47008c500b459a9" title="获取8位整数低位起第p位的值">__getb8</a>(<a class="code" href="group___xE6_x95_xB4_xE5_x9E_x8B_xE5_xAE_x9A_xE4_xB9_x89.html#gae1affc9ca37cfb624959c866a73f83c2" title="8比特无符号整型">uint8_t</a> x, <span class="keywordtype">int</span> i)
<a name="l00348"></a>00348 {
<a name="l00349"></a>00349     <span class="keywordflow">return</span> (<span class="keywordtype">int</span>)((x &gt;&gt; i) &amp; 1);
<a name="l00350"></a>00350 }
<a name="l00351"></a>00351 
<a name="l00361"></a><a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#gae2c3ae6d395e2e7e4b7f384a655c1908">00361</a> <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">int</span> <a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#gae2c3ae6d395e2e7e4b7f384a655c1908" title="获取16位整数低位起第p位的值">__getb16</a>(uint16_t x, <span class="keywordtype">int</span> i)
<a name="l00362"></a>00362 {
<a name="l00363"></a>00363     <span class="keywordflow">return</span> (<span class="keywordtype">int</span>)((x &gt;&gt; i) &amp; 1);
<a name="l00364"></a>00364 }
<a name="l00365"></a>00365 
<a name="l00375"></a><a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#gafed3d233ae505d633b65d8b1453e8f16">00375</a> <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">int</span> <a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#gafed3d233ae505d633b65d8b1453e8f16" title="获取32位整数低位起第p位的值">__getb32</a>(uint32_t x, <span class="keywordtype">int</span> i)
<a name="l00376"></a>00376 {
<a name="l00377"></a>00377     <span class="keywordflow">return</span> (<span class="keywordtype">int</span>)((x &gt;&gt; i) &amp; 1UL);
<a name="l00378"></a>00378 }
<a name="l00379"></a>00379 
<a name="l00389"></a><a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#gaab54320805583d68da36533af6dd428d">00389</a> <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">int</span> <a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#gaab54320805583d68da36533af6dd428d" title="获取8位整数低位起第p位的值">__getb8_p</a>(<span class="keywordtype">void</span>* p, <span class="keywordtype">int</span> i)
<a name="l00390"></a>00390 {
<a name="l00391"></a>00391     <span class="keywordflow">return</span> (<span class="keywordtype">int</span>)((*((<a class="code" href="group___xE6_x95_xB4_xE5_x9E_x8B_xE5_xAE_x9A_xE4_xB9_x89.html#gae1affc9ca37cfb624959c866a73f83c2" title="8比特无符号整型">uint8_t</a>*)p) &gt;&gt; i) &amp; 1);
<a name="l00392"></a>00392 }
<a name="l00393"></a>00393 
<a name="l00403"></a><a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#gabb4058b98f82a07ff6edf79476b57ece">00403</a> <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">int</span> <a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#gabb4058b98f82a07ff6edf79476b57ece" title="获取16位整数低位起第p位的值">__getb16_p</a>(<span class="keywordtype">void</span>* p, <span class="keywordtype">int</span> i)
<a name="l00404"></a>00404 {
<a name="l00405"></a>00405     <span class="keywordflow">return</span> (<span class="keywordtype">int</span>)((*((uint16_t*)p) &gt;&gt; i) &amp; 1);
<a name="l00406"></a>00406 }
<a name="l00407"></a>00407 
<a name="l00417"></a><a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#gaf526e92b9ace04d14fae438b8a49a806">00417</a> <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">int</span> <a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#gaf526e92b9ace04d14fae438b8a49a806" title="获取32位整数低位起第p位的值">__getb32_p</a>(<span class="keywordtype">void</span>* p, <span class="keywordtype">int</span> i)
<a name="l00418"></a>00418 {
<a name="l00419"></a>00419     <span class="keywordflow">return</span> (<span class="keywordtype">int</span>)((*((uint32_t*)p) &gt;&gt; i) &amp; 1UL);
<a name="l00420"></a>00420 }
<a name="l00421"></a>00421 
<a name="l00429"></a><a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#gae9e39e972bafa923735f39260bec443f">00429</a> <span class="keyword">static</span> <span class="keyword">inline</span> <a class="code" href="group___xE6_x95_xB4_xE5_x9E_x8B_xE5_xAE_x9A_xE4_xB9_x89.html#gae1affc9ca37cfb624959c866a73f83c2" title="8比特无符号整型">uint8_t</a> <a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#gae9e39e972bafa923735f39260bec443f" title="修改8位整数低位起第p位为1">__setb8</a>(<a class="code" href="group___xE6_x95_xB4_xE5_x9E_x8B_xE5_xAE_x9A_xE4_xB9_x89.html#gae1affc9ca37cfb624959c866a73f83c2" title="8比特无符号整型">uint8_t</a> x, <span class="keywordtype">int</span> i)
<a name="l00430"></a>00430 {
<a name="l00431"></a>00431     <span class="keywordflow">return</span> x | (1 &lt;&lt; i);
<a name="l00432"></a>00432 }
<a name="l00433"></a>00433 
<a name="l00441"></a><a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#gaccda2bd25e5fba5585813ce31fb2e9a5">00441</a> <span class="keyword">static</span> <span class="keyword">inline</span> uint16_t <a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#gaccda2bd25e5fba5585813ce31fb2e9a5" title="修改16位整数低位起第p位为1">__setb16</a>(uint16_t x, <span class="keywordtype">int</span> i)
<a name="l00442"></a>00442 {
<a name="l00443"></a>00443     <span class="keywordflow">return</span> x | (1 &lt;&lt; i);
<a name="l00444"></a>00444 }
<a name="l00445"></a>00445 
<a name="l00453"></a><a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#ga7db54bcfbb1c0ba0909a234f6b031298">00453</a> <span class="keyword">static</span> <span class="keyword">inline</span> uint32_t <a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#ga7db54bcfbb1c0ba0909a234f6b031298" title="修改32位整数低位起第p位为1">__setb32</a>(uint32_t x, <span class="keywordtype">int</span> i)
<a name="l00454"></a>00454 {
<a name="l00455"></a>00455     <span class="keywordflow">return</span> x | (1UL &lt;&lt; i);
<a name="l00456"></a>00456 }
<a name="l00457"></a>00457 
<a name="l00465"></a><a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#ga937d963e5428da5019804eae0152589f">00465</a> <span class="keyword">static</span> <span class="keyword">inline</span> <a class="code" href="group___xE6_x95_xB4_xE5_x9E_x8B_xE5_xAE_x9A_xE4_xB9_x89.html#gae1affc9ca37cfb624959c866a73f83c2" title="8比特无符号整型">uint8_t</a> <a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#ga937d963e5428da5019804eae0152589f" title="修改指定内存地址的8位整数低位起第p位为1，结果不存回原址">__setb8_p</a>(<span class="keywordtype">void</span>* p, <span class="keywordtype">int</span> i)
<a name="l00466"></a>00466 {
<a name="l00467"></a>00467     <span class="keywordflow">return</span> *((<a class="code" href="group___xE6_x95_xB4_xE5_x9E_x8B_xE5_xAE_x9A_xE4_xB9_x89.html#gae1affc9ca37cfb624959c866a73f83c2" title="8比特无符号整型">uint8_t</a>*)p) | (1 &lt;&lt; i);
<a name="l00468"></a>00468 }
<a name="l00469"></a>00469 
<a name="l00477"></a><a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#gab59add5f9bf033e0bf553a5c2b73aac6">00477</a> <span class="keyword">static</span> <span class="keyword">inline</span> uint16_t <a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#gab59add5f9bf033e0bf553a5c2b73aac6" title="修改指定内存地址的16位整数低位起第p位为1，结果不存回原址">__setb16_p</a>(<span class="keywordtype">void</span>* p, <span class="keywordtype">int</span> i)
<a name="l00478"></a>00478 {
<a name="l00479"></a>00479     <span class="keywordflow">return</span> *((uint16_t*)p) | (1 &lt;&lt; i);
<a name="l00480"></a>00480 }
<a name="l00481"></a>00481 
<a name="l00489"></a><a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#gaf168e51d4b0cfb5baa0ebfa67df91e6a">00489</a> <span class="keyword">static</span> <span class="keyword">inline</span> uint32_t <a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#gaf168e51d4b0cfb5baa0ebfa67df91e6a" title="修改指定内存地址的32位整数低位起第p位为1，结果不存回原址">__setb32_p</a>(<span class="keywordtype">void</span>* p, <span class="keywordtype">int</span> i)
<a name="l00490"></a>00490 {
<a name="l00491"></a>00491     <span class="keywordflow">return</span> *((uint32_t*)p) | (1UL &lt;&lt; i);
<a name="l00492"></a>00492 }
<a name="l00493"></a>00493 
<a name="l00500"></a><a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#ga46afc8abbe87d7f138c68fb2ded6a1be">00500</a> <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#ga46afc8abbe87d7f138c68fb2ded6a1be" title="修改指定内存地址的8位整数低位起第p位为1，并将结果不存回原址">__setb8_s</a>(<span class="keywordtype">void</span>* p, <span class="keywordtype">int</span> i)
<a name="l00501"></a>00501 {
<a name="l00502"></a>00502     *((<a class="code" href="group___xE6_x95_xB4_xE5_x9E_x8B_xE5_xAE_x9A_xE4_xB9_x89.html#gae1affc9ca37cfb624959c866a73f83c2" title="8比特无符号整型">uint8_t</a>*)p) |= (1 &lt;&lt; i);
<a name="l00503"></a>00503 }
<a name="l00504"></a>00504 
<a name="l00511"></a><a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#gac7b74cbaa452988256f39695df7eaa51">00511</a> <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#gac7b74cbaa452988256f39695df7eaa51" title="修改指定内存地址的16位整数低位起第p位为1，并将结果不存回原址">__setb16_s</a>(<span class="keywordtype">void</span>* p, <span class="keywordtype">int</span> i)
<a name="l00512"></a>00512 {
<a name="l00513"></a>00513     *((uint16_t*)p) |= (1 &lt;&lt; i);
<a name="l00514"></a>00514 }
<a name="l00515"></a>00515 
<a name="l00522"></a><a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#ga5dad982c470ba5196149ee2c5ce871db">00522</a> <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#ga5dad982c470ba5196149ee2c5ce871db" title="修改指定内存地址的32位整数低位起第p位为1，并将结果存回原址">__setb32_s</a>(<span class="keywordtype">void</span>* p, <span class="keywordtype">int</span> i)
<a name="l00523"></a>00523 {
<a name="l00524"></a>00524     *((uint32_t*)p) |= (1UL &lt;&lt; i);
<a name="l00525"></a>00525 }
<a name="l00526"></a>00526 
<a name="l00534"></a><a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#ga2f01f81c67f429dc9b4acfe37daed48c">00534</a> <span class="keyword">static</span> <span class="keyword">inline</span> <a class="code" href="group___xE6_x95_xB4_xE5_x9E_x8B_xE5_xAE_x9A_xE4_xB9_x89.html#gae1affc9ca37cfb624959c866a73f83c2" title="8比特无符号整型">uint8_t</a> <a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#ga2f01f81c67f429dc9b4acfe37daed48c" title="修改8位整数低位起第p位为0">__clrb8</a>(<a class="code" href="group___xE6_x95_xB4_xE5_x9E_x8B_xE5_xAE_x9A_xE4_xB9_x89.html#gae1affc9ca37cfb624959c866a73f83c2" title="8比特无符号整型">uint8_t</a> x, <span class="keywordtype">int</span> i)
<a name="l00535"></a>00535 {
<a name="l00536"></a>00536     <span class="keywordflow">return</span> x &amp; (~(1 &lt;&lt; i));
<a name="l00537"></a>00537 }
<a name="l00538"></a>00538 
<a name="l00546"></a><a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#ga22d338b8857ac58d0451cc0f8f78c179">00546</a> <span class="keyword">static</span> <span class="keyword">inline</span> uint16_t <a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#ga22d338b8857ac58d0451cc0f8f78c179" title="修改16位整数低位起第p位为0">__clrb16</a>(uint16_t x, <span class="keywordtype">int</span> i)
<a name="l00547"></a>00547 {
<a name="l00548"></a>00548     <span class="keywordflow">return</span> x &amp; (~(1 &lt;&lt; i));
<a name="l00549"></a>00549 }
<a name="l00550"></a>00550 
<a name="l00558"></a><a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#ga15dbef737d407b3ee893bd5bf3135636">00558</a> <span class="keyword">static</span> <span class="keyword">inline</span> uint32_t <a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#ga15dbef737d407b3ee893bd5bf3135636" title="修改32位整数低位起第p位为0">__clrb32</a>(uint32_t x, <span class="keywordtype">int</span> i)
<a name="l00559"></a>00559 {
<a name="l00560"></a>00560     <span class="keywordflow">return</span> x &amp; (~(1UL &lt;&lt; i));
<a name="l00561"></a>00561 }
<a name="l00562"></a>00562 
<a name="l00570"></a><a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#ga234cabeef036422ff2b7ffad2181d535">00570</a> <span class="keyword">static</span> <span class="keyword">inline</span> <a class="code" href="group___xE6_x95_xB4_xE5_x9E_x8B_xE5_xAE_x9A_xE4_xB9_x89.html#gae1affc9ca37cfb624959c866a73f83c2" title="8比特无符号整型">uint8_t</a> <a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#ga234cabeef036422ff2b7ffad2181d535" title="修改指定内存地址的8位整数低位起第p位为0，结果不存回原址">__clrb8_p</a>(<span class="keywordtype">void</span>* p, <span class="keywordtype">int</span> i)
<a name="l00571"></a>00571 {
<a name="l00572"></a>00572     <span class="keywordflow">return</span> *((<a class="code" href="group___xE6_x95_xB4_xE5_x9E_x8B_xE5_xAE_x9A_xE4_xB9_x89.html#gae1affc9ca37cfb624959c866a73f83c2" title="8比特无符号整型">uint8_t</a>*)p) &amp; (~(1 &lt;&lt; i));
<a name="l00573"></a>00573 }
<a name="l00574"></a>00574 
<a name="l00582"></a><a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#gad31871109744bcdec7ff4c863d1f8339">00582</a> <span class="keyword">static</span> <span class="keyword">inline</span> uint16_t <a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#gad31871109744bcdec7ff4c863d1f8339" title="修改指定内存地址的16位整数低位起第p位为0，结果不存回原址">__clrb16_p</a>(<span class="keywordtype">void</span>* p, <span class="keywordtype">int</span> i)
<a name="l00583"></a>00583 {
<a name="l00584"></a>00584     <span class="keywordflow">return</span> *((uint16_t*)p) &amp; (~(1 &lt;&lt; i));
<a name="l00585"></a>00585 }
<a name="l00586"></a>00586 
<a name="l00594"></a><a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#gab7b489b6e701f3b68776a928c0d061b8">00594</a> <span class="keyword">static</span> <span class="keyword">inline</span> uint32_t <a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#gab7b489b6e701f3b68776a928c0d061b8" title="修改指定内存地址的32位整数低位起第p位为0，结果不存回原址">__clrb32_p</a>(<span class="keywordtype">void</span>* p, <span class="keywordtype">int</span> i)
<a name="l00595"></a>00595 {
<a name="l00596"></a>00596     <span class="keywordflow">return</span> *((uint32_t*)p) &amp; (~(1UL &lt;&lt; i));
<a name="l00597"></a>00597 }
<a name="l00598"></a>00598 
<a name="l00605"></a><a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#ga60542a5296393c08ddab7c53df49e9d0">00605</a> <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#ga60542a5296393c08ddab7c53df49e9d0" title="修改指定内存地址的8位整数低位起第p位为0，并将结果存回原址">__clrb8_s</a>(<span class="keywordtype">void</span>* p, <span class="keywordtype">int</span> i)
<a name="l00606"></a>00606 {
<a name="l00607"></a>00607     *((<a class="code" href="group___xE6_x95_xB4_xE5_x9E_x8B_xE5_xAE_x9A_xE4_xB9_x89.html#gae1affc9ca37cfb624959c866a73f83c2" title="8比特无符号整型">uint8_t</a>*)p) &amp;= (~(1 &lt;&lt; i));
<a name="l00608"></a>00608 }
<a name="l00609"></a>00609 
<a name="l00616"></a><a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#ga2938ec7a1ad4a0ae7ddb8780ffa06987">00616</a> <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#ga2938ec7a1ad4a0ae7ddb8780ffa06987" title="修改指定内存地址的16位整数低位起第p位为0，并将结果存回原址">__clrb16_s</a>(<span class="keywordtype">void</span>* p, <span class="keywordtype">int</span> i)
<a name="l00617"></a>00617 {
<a name="l00618"></a>00618     *((uint16_t*)p) &amp;= (~(1 &lt;&lt; i));
<a name="l00619"></a>00619 }
<a name="l00620"></a>00620 
<a name="l00627"></a><a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#gadb7b9f4464c90d68f5a4df4e5bcf2110">00627</a> <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#gadb7b9f4464c90d68f5a4df4e5bcf2110" title="修改指定内存地址的32位整数低位起第p位为0，并将结果存回原址">__clrb32_s</a>(<span class="keywordtype">void</span>* p, <span class="keywordtype">int</span> i)
<a name="l00628"></a>00628 {
<a name="l00629"></a>00629     *((uint32_t*)p) &amp;= (~(1UL &lt;&lt; i));
<a name="l00630"></a>00630 }
<a name="l00631"></a>00631 
<a name="l00637"></a><a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#gad376b36f0a099037c4b1407d60bd0abb">00637</a> <span class="preprocessor">#define __to_gray_c(x) ((x) ^ ((x) &gt;&gt; 1))</span>
<a name="l00638"></a>00638 <span class="preprocessor"></span>
<a name="l00645"></a><a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#gafe024cfad4ef29e33855496e1cfb94d1">00645</a> <span class="keyword">static</span> <span class="keyword">inline</span> <a class="code" href="group___xE6_x95_xB4_xE5_x9E_x8B_xE5_xAE_x9A_xE4_xB9_x89.html#gae1affc9ca37cfb624959c866a73f83c2" title="8比特无符号整型">uint8_t</a> <a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#gafe024cfad4ef29e33855496e1cfb94d1" title="8位自然码转格雷码">__to_gray8</a>(<a class="code" href="group___xE6_x95_xB4_xE5_x9E_x8B_xE5_xAE_x9A_xE4_xB9_x89.html#gae1affc9ca37cfb624959c866a73f83c2" title="8比特无符号整型">uint8_t</a> x)
<a name="l00646"></a>00646 {
<a name="l00647"></a>00647     <span class="keywordflow">return</span> <a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#gad376b36f0a099037c4b1407d60bd0abb" title="自然码常量转格雷码常量">__to_gray_c</a>(x);
<a name="l00648"></a>00648 }
<a name="l00649"></a>00649 
<a name="l00656"></a><a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#ga82cc4e520f7c63942496408ec80a61c6">00656</a> <span class="keyword">static</span> <span class="keyword">inline</span> <a class="code" href="group___xE6_x95_xB4_xE5_x9E_x8B_xE5_xAE_x9A_xE4_xB9_x89.html#gae1affc9ca37cfb624959c866a73f83c2" title="8比特无符号整型">uint8_t</a> <a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#ga82cc4e520f7c63942496408ec80a61c6" title="将指定内存地址的8位自然码转格雷码，但不存回p">__to_gray8_p</a>(<span class="keywordtype">void</span>* p)
<a name="l00657"></a>00657 {
<a name="l00658"></a>00658     <span class="keywordflow">return</span> <a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#gafe024cfad4ef29e33855496e1cfb94d1" title="8位自然码转格雷码">__to_gray8</a>(*((<a class="code" href="group___xE6_x95_xB4_xE5_x9E_x8B_xE5_xAE_x9A_xE4_xB9_x89.html#gae1affc9ca37cfb624959c866a73f83c2" title="8比特无符号整型">uint8_t</a>*)p));
<a name="l00659"></a>00659 }
<a name="l00660"></a>00660 
<a name="l00666"></a><a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#ga6ad216907bd31151224065d7a898e90d">00666</a> <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#ga6ad216907bd31151224065d7a898e90d" title="将指定内存地址的8位自然码转格雷码，并存回p">__to_gray8_s</a>(<span class="keywordtype">void</span>* p)
<a name="l00667"></a>00667 {
<a name="l00668"></a>00668     *((<a class="code" href="group___xE6_x95_xB4_xE5_x9E_x8B_xE5_xAE_x9A_xE4_xB9_x89.html#gae1affc9ca37cfb624959c866a73f83c2" title="8比特无符号整型">uint8_t</a>*)p) = <a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#gafe024cfad4ef29e33855496e1cfb94d1" title="8位自然码转格雷码">__to_gray8</a>(*((<a class="code" href="group___xE6_x95_xB4_xE5_x9E_x8B_xE5_xAE_x9A_xE4_xB9_x89.html#gae1affc9ca37cfb624959c866a73f83c2" title="8比特无符号整型">uint8_t</a>*)p));
<a name="l00669"></a>00669 }
<a name="l00670"></a>00670 
<a name="l00677"></a><a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#gaa0783e1bb75119ac4fc41211057c4b42">00677</a> <span class="keyword">static</span> <span class="keyword">inline</span> <a class="code" href="group___xE6_x95_xB4_xE5_x9E_x8B_xE5_xAE_x9A_xE4_xB9_x89.html#gae1affc9ca37cfb624959c866a73f83c2" title="8比特无符号整型">uint8_t</a> <a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#gaa0783e1bb75119ac4fc41211057c4b42" title="8位格雷码转自然码">__to_natural8</a>(<a class="code" href="group___xE6_x95_xB4_xE5_x9E_x8B_xE5_xAE_x9A_xE4_xB9_x89.html#gae1affc9ca37cfb624959c866a73f83c2" title="8比特无符号整型">uint8_t</a> x)
<a name="l00678"></a>00678 {
<a name="l00679"></a>00679     x = x ^ (x &gt;&gt; 1);
<a name="l00680"></a>00680     x = x ^ (x &gt;&gt; 2);
<a name="l00681"></a>00681     x = x ^ (x &gt;&gt; 4);
<a name="l00682"></a>00682     <span class="keywordflow">return</span> x;
<a name="l00683"></a>00683 }
<a name="l00684"></a>00684 
<a name="l00691"></a><a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#ga2d24656606e43ebd536deb18b2f6a1b6">00691</a> <span class="keyword">static</span> <span class="keyword">inline</span> <a class="code" href="group___xE6_x95_xB4_xE5_x9E_x8B_xE5_xAE_x9A_xE4_xB9_x89.html#gae1affc9ca37cfb624959c866a73f83c2" title="8比特无符号整型">uint8_t</a> <a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#ga2d24656606e43ebd536deb18b2f6a1b6" title="将指定内存地址的8位格雷码转自然码，但不存回p">__to_natural8_p</a>(<span class="keywordtype">void</span>* p)
<a name="l00692"></a>00692 {
<a name="l00693"></a>00693     <span class="keywordflow">return</span> <a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#gaa0783e1bb75119ac4fc41211057c4b42" title="8位格雷码转自然码">__to_natural8</a>(*((<a class="code" href="group___xE6_x95_xB4_xE5_x9E_x8B_xE5_xAE_x9A_xE4_xB9_x89.html#gae1affc9ca37cfb624959c866a73f83c2" title="8比特无符号整型">uint8_t</a>*)p));
<a name="l00694"></a>00694 }
<a name="l00695"></a>00695 
<a name="l00701"></a><a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#ga480edc34b5a86ee802ca7edee10367e0">00701</a> <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#ga480edc34b5a86ee802ca7edee10367e0" title="将指定内存地址的8位格雷码转自然码，并存回p">__to_natural8_s</a>(<span class="keywordtype">void</span>* p)
<a name="l00702"></a>00702 {
<a name="l00703"></a>00703     *((<a class="code" href="group___xE6_x95_xB4_xE5_x9E_x8B_xE5_xAE_x9A_xE4_xB9_x89.html#gae1affc9ca37cfb624959c866a73f83c2" title="8比特无符号整型">uint8_t</a>*)p) = <a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#gaa0783e1bb75119ac4fc41211057c4b42" title="8位格雷码转自然码">__to_natural8</a>(*((<a class="code" href="group___xE6_x95_xB4_xE5_x9E_x8B_xE5_xAE_x9A_xE4_xB9_x89.html#gae1affc9ca37cfb624959c866a73f83c2" title="8比特无符号整型">uint8_t</a>*)p));
<a name="l00704"></a>00704 }
<a name="l00705"></a>00705 
<a name="l00712"></a><a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#ga66df95d591729e49cd2cd9f5d25d81d3">00712</a> <span class="keyword">static</span> <span class="keyword">inline</span> uint16_t <a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#ga66df95d591729e49cd2cd9f5d25d81d3" title="16位自然码转格雷码">__to_gray16</a>(uint16_t x)
<a name="l00713"></a>00713 {
<a name="l00714"></a>00714     <span class="keywordflow">return</span> <a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#gad376b36f0a099037c4b1407d60bd0abb" title="自然码常量转格雷码常量">__to_gray_c</a>(x);
<a name="l00715"></a>00715 }
<a name="l00716"></a>00716 
<a name="l00723"></a><a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#ga99bf0550fa319e594f7d03690c9a32bc">00723</a> <span class="keyword">static</span> <span class="keyword">inline</span> uint16_t <a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#ga99bf0550fa319e594f7d03690c9a32bc" title="将指定内存地址的16位自然码转格雷码，但不存回p">__to_gray16_p</a>(<span class="keywordtype">void</span>* p)
<a name="l00724"></a>00724 {
<a name="l00725"></a>00725     <span class="keywordflow">return</span> <a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#ga66df95d591729e49cd2cd9f5d25d81d3" title="16位自然码转格雷码">__to_gray16</a>(*((uint16_t*)p));
<a name="l00726"></a>00726 }
<a name="l00727"></a>00727 
<a name="l00733"></a><a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#gaefdaaf9229374183175cdaa1d243f17e">00733</a> <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#gaefdaaf9229374183175cdaa1d243f17e" title="将指定内存地址的16位自然码转格雷码，并存回p">__to_gray16_s</a>(<span class="keywordtype">void</span>* p)
<a name="l00734"></a>00734 {
<a name="l00735"></a>00735     *((uint16_t*)p) = <a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#ga66df95d591729e49cd2cd9f5d25d81d3" title="16位自然码转格雷码">__to_gray16</a>(*((uint16_t*)p));
<a name="l00736"></a>00736 }
<a name="l00737"></a>00737 
<a name="l00744"></a><a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#gaa7e98c183c0487d07d084c47943320bf">00744</a> <span class="keyword">static</span> <span class="keyword">inline</span> uint16_t <a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#gaa7e98c183c0487d07d084c47943320bf" title="16位格雷码转自然码">__to_natural16</a>(uint16_t x)
<a name="l00745"></a>00745 {
<a name="l00746"></a>00746     x = x ^ (x &gt;&gt; 1);
<a name="l00747"></a>00747     x = x ^ (x &gt;&gt; 2);
<a name="l00748"></a>00748     x = x ^ (x &gt;&gt; 4);
<a name="l00749"></a>00749     x = x ^ (x &gt;&gt; 8);
<a name="l00750"></a>00750     <span class="keywordflow">return</span> x;
<a name="l00751"></a>00751 }
<a name="l00752"></a>00752 
<a name="l00759"></a><a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#ga885da15296586c937539d31bea1bbc59">00759</a> <span class="keyword">static</span> <span class="keyword">inline</span> uint16_t <a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#ga885da15296586c937539d31bea1bbc59" title="将指定内存地址的16位格雷码转自然码，但不存回p">__to_natural16_p</a>(<span class="keywordtype">void</span>* p)
<a name="l00760"></a>00760 {
<a name="l00761"></a>00761     <span class="keywordflow">return</span> <a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#gaa7e98c183c0487d07d084c47943320bf" title="16位格雷码转自然码">__to_natural16</a>(*((uint16_t*)p));
<a name="l00762"></a>00762 }
<a name="l00763"></a>00763 
<a name="l00769"></a><a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#gaf5ef7c6fb066b29a65ed6a1dac20515d">00769</a> <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#gaf5ef7c6fb066b29a65ed6a1dac20515d" title="将指定内存地址的16位格雷码转自然码，并存回p">__to_natural16_s</a>(<span class="keywordtype">void</span>* p)
<a name="l00770"></a>00770 {
<a name="l00771"></a>00771     *((uint16_t*)p) = <a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#gaa7e98c183c0487d07d084c47943320bf" title="16位格雷码转自然码">__to_natural16</a>(*((uint16_t*)p));
<a name="l00772"></a>00772 }
<a name="l00773"></a>00773 
<a name="l00780"></a><a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#gabadc245ad86af9c64e082652b6c509cc">00780</a> <span class="keyword">static</span> <span class="keyword">inline</span> uint32_t <a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#gabadc245ad86af9c64e082652b6c509cc" title="32位自然码转格雷码">__to_gray32</a>(uint32_t x)
<a name="l00781"></a>00781 {
<a name="l00782"></a>00782     <span class="keywordflow">return</span> <a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#gad376b36f0a099037c4b1407d60bd0abb" title="自然码常量转格雷码常量">__to_gray_c</a>(x);
<a name="l00783"></a>00783 }
<a name="l00784"></a>00784 
<a name="l00791"></a><a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#gae5639ab8d96163b9647169d5d532ae92">00791</a> <span class="keyword">static</span> <span class="keyword">inline</span> uint32_t <a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#gae5639ab8d96163b9647169d5d532ae92" title="将指定内存地址的32位自然码转格雷码，但不存回p">__to_gray32_p</a>(<span class="keywordtype">void</span>* p)
<a name="l00792"></a>00792 {
<a name="l00793"></a>00793     <span class="keywordflow">return</span> <a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#gabadc245ad86af9c64e082652b6c509cc" title="32位自然码转格雷码">__to_gray32</a>(*((uint32_t*)p));
<a name="l00794"></a>00794 }
<a name="l00795"></a>00795 
<a name="l00801"></a><a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#ga7ba699f6b6647bf196857cc503608405">00801</a> <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#ga7ba699f6b6647bf196857cc503608405" title="将指定内存地址的32位自然码转格雷码，并存回p">__to_gray32_s</a>(<span class="keywordtype">void</span>* p)
<a name="l00802"></a>00802 {
<a name="l00803"></a>00803     *((uint32_t*)p) = <a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#gabadc245ad86af9c64e082652b6c509cc" title="32位自然码转格雷码">__to_gray32</a>(*((uint32_t*)p));
<a name="l00804"></a>00804 }
<a name="l00805"></a>00805 
<a name="l00812"></a><a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#gab070cb0bb3f71b6a8e19a6b146f4fe4d">00812</a> <span class="keyword">static</span> <span class="keyword">inline</span> uint32_t <a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#gab070cb0bb3f71b6a8e19a6b146f4fe4d" title="32位格雷码转自然码">__to_natural32</a>(uint32_t x)
<a name="l00813"></a>00813 {
<a name="l00814"></a>00814     x = x ^ (x &gt;&gt;  1);
<a name="l00815"></a>00815     x = x ^ (x &gt;&gt;  2);
<a name="l00816"></a>00816     x = x ^ (x &gt;&gt;  4);
<a name="l00817"></a>00817     x = x ^ (x &gt;&gt;  8);
<a name="l00818"></a>00818     x = x ^ (x &gt;&gt; 16);
<a name="l00819"></a>00819     <span class="keywordflow">return</span> x;
<a name="l00820"></a>00820 }
<a name="l00821"></a>00821 
<a name="l00828"></a><a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#ga0d6012948be1333f218ddf11cf666595">00828</a> <span class="keyword">static</span> <span class="keyword">inline</span> uint32_t <a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#ga0d6012948be1333f218ddf11cf666595" title="将指定内存地址的32位格雷码转自然码，但不存回p">__to_natural32_p</a>(<span class="keywordtype">void</span>* p)
<a name="l00829"></a>00829 {
<a name="l00830"></a>00830     <span class="keywordflow">return</span> <a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#gab070cb0bb3f71b6a8e19a6b146f4fe4d" title="32位格雷码转自然码">__to_natural32</a>(*((uint32_t*)p));
<a name="l00831"></a>00831 }
<a name="l00832"></a>00832 
<a name="l00838"></a><a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#gae031171f9f79aca485b4c12158cb5775">00838</a> <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#gae031171f9f79aca485b4c12158cb5775" title="将指定内存地址的32位格雷码转自然码，并存回p">__to_natural32_s</a>(<span class="keywordtype">void</span>* p)
<a name="l00839"></a>00839 {
<a name="l00840"></a>00840     *((uint32_t*)p) = <a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#gab070cb0bb3f71b6a8e19a6b146f4fe4d" title="32位格雷码转自然码">__to_natural32</a>(*((uint32_t*)p));
<a name="l00841"></a>00841 }
<a name="l00842"></a>00842 
<a name="l00849"></a><a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#gac0066efee366b5d596978bdf421f5449">00849</a> <span class="keyword">static</span> <span class="keyword">inline</span> <a class="code" href="group___xE6_x95_xB4_xE5_x9E_x8B_xE5_xAE_x9A_xE4_xB9_x89.html#gae1affc9ca37cfb624959c866a73f83c2" title="8比特无符号整型">uint8_t</a> <a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#gac0066efee366b5d596978bdf421f5449" title="按位反转8位整数">__flip8</a>(<a class="code" href="group___xE6_x95_xB4_xE5_x9E_x8B_xE5_xAE_x9A_xE4_xB9_x89.html#gae1affc9ca37cfb624959c866a73f83c2" title="8比特无符号整型">uint8_t</a> x)
<a name="l00850"></a>00850 {
<a name="l00851"></a>00851     x = ((x &gt;&gt; 1) &amp; 0x55) | ((x &amp; 0x55) &lt;&lt; 1);
<a name="l00852"></a>00852     x = ((x &gt;&gt; 2) &amp; 0x33) | ((x &amp; 0x33) &lt;&lt; 2);
<a name="l00853"></a>00853     x = ((x &gt;&gt; 4) &amp; 0x0F) | ((x &amp; 0x0F) &lt;&lt; 4);
<a name="l00854"></a>00854     <span class="keywordflow">return</span> x;
<a name="l00855"></a>00855 }
<a name="l00856"></a>00856 
<a name="l00863"></a><a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#gac65307428cf073c00405d0c05ded4eda">00863</a> <span class="keyword">static</span> <span class="keyword">inline</span> uint16_t <a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#gac65307428cf073c00405d0c05ded4eda" title="按位反转16位整数">__flip16</a>(uint16_t x)
<a name="l00864"></a>00864 {
<a name="l00865"></a>00865     x = ((x &gt;&gt; 1) &amp; 0x5555) | ((x &amp; 0x5555) &lt;&lt; 1);
<a name="l00866"></a>00866     x = ((x &gt;&gt; 2) &amp; 0x3333) | ((x &amp; 0x3333) &lt;&lt; 2);
<a name="l00867"></a>00867     x = ((x &gt;&gt; 4) &amp; 0x0F0F) | ((x &amp; 0x0F0F) &lt;&lt; 4);
<a name="l00868"></a>00868     x = ((x &gt;&gt; 8) &amp; 0x00FF) | ((x &amp; 0x00FF) &lt;&lt; 8);
<a name="l00869"></a>00869     <span class="keywordflow">return</span> x;
<a name="l00870"></a>00870 }
<a name="l00871"></a>00871 
<a name="l00878"></a><a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#ga589694431595094c1482bd580e8f610f">00878</a> <span class="keyword">static</span> <span class="keyword">inline</span> uint32_t <a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#ga589694431595094c1482bd580e8f610f" title="按位反转32位整数">__flip32</a>(uint32_t x)
<a name="l00879"></a>00879 {
<a name="l00880"></a>00880     x = ((x &gt;&gt;  1) &amp; 0x55555555UL) | ((x &amp; 0x55555555UL) &lt;&lt;  1);
<a name="l00881"></a>00881     x = ((x &gt;&gt;  2) &amp; 0x33333333UL) | ((x &amp; 0x33333333UL) &lt;&lt;  2);
<a name="l00882"></a>00882     x = ((x &gt;&gt;  4) &amp; 0x0F0F0F0FUL) | ((x &amp; 0x0F0F0F0FUL) &lt;&lt;  4);
<a name="l00883"></a>00883     x = ((x &gt;&gt;  8) &amp; 0x00FF00FFUL) | ((x &amp; 0x00FF00FFUL) &lt;&lt;  8);
<a name="l00884"></a>00884     x = ((x &gt;&gt; 16)               ) | ((x               ) &lt;&lt; 16);
<a name="l00885"></a>00885     <span class="keywordflow">return</span> x;
<a name="l00886"></a>00886 }
<a name="l00887"></a>00887 
<a name="l00894"></a><a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#gafe4f1b75fae7562adfb8e69a9b472cf8">00894</a> <span class="keyword">static</span> <span class="keyword">inline</span> <a class="code" href="group___xE6_x95_xB4_xE5_x9E_x8B_xE5_xAE_x9A_xE4_xB9_x89.html#gae1affc9ca37cfb624959c866a73f83c2" title="8比特无符号整型">uint8_t</a> <a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#gafe4f1b75fae7562adfb8e69a9b472cf8" title="指定地址的8位整数按位反转，不存回原址">__flip8_p</a>(<span class="keywordtype">void</span>* p)
<a name="l00895"></a>00895 {
<a name="l00896"></a>00896     <span class="keywordflow">return</span> <a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#gac0066efee366b5d596978bdf421f5449" title="按位反转8位整数">__flip8</a>(*((<a class="code" href="group___xE6_x95_xB4_xE5_x9E_x8B_xE5_xAE_x9A_xE4_xB9_x89.html#gae1affc9ca37cfb624959c866a73f83c2" title="8比特无符号整型">uint8_t</a>*)p));
<a name="l00897"></a>00897 }
<a name="l00898"></a>00898 
<a name="l00905"></a><a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#ga25592df966e08fcd2290828b4b0d6c80">00905</a> <span class="keyword">static</span> <span class="keyword">inline</span> uint16_t <a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#ga25592df966e08fcd2290828b4b0d6c80" title="指定地址的16位整数按位反转，不存回原址">__flip16_p</a>(<span class="keywordtype">void</span>* p)
<a name="l00906"></a>00906 {
<a name="l00907"></a>00907     <span class="keywordflow">return</span> <a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#gac65307428cf073c00405d0c05ded4eda" title="按位反转16位整数">__flip16</a>(*((uint16_t*)p));
<a name="l00908"></a>00908 }
<a name="l00909"></a>00909 
<a name="l00916"></a><a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#ga459d5b69230f78a5b3c52be0f231ff9c">00916</a> <span class="keyword">static</span> <span class="keyword">inline</span> uint32_t <a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#ga459d5b69230f78a5b3c52be0f231ff9c" title="指定地址的32位整数按位反转，不存回原址">__flip32_p</a>(<span class="keywordtype">void</span>* p)
<a name="l00917"></a>00917 {
<a name="l00918"></a>00918     <span class="keywordflow">return</span> <a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#ga589694431595094c1482bd580e8f610f" title="按位反转32位整数">__flip32</a>(*((uint32_t*)p));
<a name="l00919"></a>00919 }
<a name="l00920"></a>00920 
<a name="l00926"></a><a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#gad4dd0abc54f2c9016f11995750ae7a68">00926</a> <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#gad4dd0abc54f2c9016f11995750ae7a68" title="指定地址的8位整数按位反转，并将结果存回原址">__flip8_s</a>(<span class="keywordtype">void</span>* p)
<a name="l00927"></a>00927 {
<a name="l00928"></a>00928     *((<a class="code" href="group___xE6_x95_xB4_xE5_x9E_x8B_xE5_xAE_x9A_xE4_xB9_x89.html#gae1affc9ca37cfb624959c866a73f83c2" title="8比特无符号整型">uint8_t</a>*)p) = <a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#gac0066efee366b5d596978bdf421f5449" title="按位反转8位整数">__flip8</a>(*((<a class="code" href="group___xE6_x95_xB4_xE5_x9E_x8B_xE5_xAE_x9A_xE4_xB9_x89.html#gae1affc9ca37cfb624959c866a73f83c2" title="8比特无符号整型">uint8_t</a>*)p));
<a name="l00929"></a>00929 }
<a name="l00930"></a>00930 
<a name="l00936"></a><a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#gafa4b31886e6a8e59b20e11097389f53c">00936</a> <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#gafa4b31886e6a8e59b20e11097389f53c" title="指定地址的16位整数按位反转，并将结果存回原址">__flip16_s</a>(<span class="keywordtype">void</span>* p)
<a name="l00937"></a>00937 {
<a name="l00938"></a>00938     *((uint16_t*)p) = <a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#gac65307428cf073c00405d0c05ded4eda" title="按位反转16位整数">__flip16</a>(*((uint16_t*)p));
<a name="l00939"></a>00939 }
<a name="l00940"></a>00940 
<a name="l00946"></a><a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#ga2bdae6f6fe46fa1b21eb9d4d236ac754">00946</a> <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#ga2bdae6f6fe46fa1b21eb9d4d236ac754" title="指定地址的32位整数按位反转，并将结果存回原址">__flip32_s</a>(<span class="keywordtype">void</span>* p)
<a name="l00947"></a>00947 {
<a name="l00948"></a>00948     *((uint32_t*)p) = <a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#ga589694431595094c1482bd580e8f610f" title="按位反转32位整数">__flip32</a>(*((uint32_t*)p));
<a name="l00949"></a>00949 }
<a name="l00950"></a>00950 
<a name="l00957"></a><a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#ga0f90a0781de4ad3f8b38d62e894df9a4">00957</a> <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">int</span> <a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#ga0f90a0781de4ad3f8b38d62e894df9a4" title="计算8位整型前导0的个数">__clz8</a>(<a class="code" href="group___xE6_x95_xB4_xE5_x9E_x8B_xE5_xAE_x9A_xE4_xB9_x89.html#gae1affc9ca37cfb624959c866a73f83c2" title="8比特无符号整型">uint8_t</a> x)
<a name="l00958"></a>00958 {
<a name="l00959"></a>00959 <span class="preprocessor">#ifdef __GNUC__</span>
<a name="l00960"></a>00960 <span class="preprocessor"></span>    <span class="keywordflow">return</span> __builtin_clz((uint32_t)x) - 24;
<a name="l00961"></a>00961 <span class="preprocessor">#elif defined(_MSC_VER) &amp;&amp; _MSC_VER &gt;= 1500 </span><span class="comment">/* VS2008以上 */</span>
<a name="l00962"></a>00962     <span class="keywordflow">return</span> (<span class="keywordtype">int</span>)__lzcnt16((uint16_t)x);
<a name="l00963"></a>00963 <span class="preprocessor">#else</span>
<a name="l00964"></a>00964 <span class="preprocessor"></span>    <span class="keywordtype">int</span> c = 8;
<a name="l00965"></a>00965     <span class="keywordflow">if</span> (x) { --c;
<a name="l00966"></a>00966         <span class="keywordflow">if</span> (x &amp; 0xF0) { x &amp;= 0xF0; c -= 4; }
<a name="l00967"></a>00967         <span class="keywordflow">if</span> (x &amp; 0xCC) { x &amp;= 0xCC; c -= 2; }
<a name="l00968"></a>00968         <span class="keywordflow">if</span> (x &amp; 0xAA) { x &amp;= 0xAA; c -= 1; }
<a name="l00969"></a>00969     }
<a name="l00970"></a>00970     <span class="keywordflow">return</span> c;
<a name="l00971"></a>00971 <span class="preprocessor">#endif </span><span class="comment">/* #ifdef __GNUC__ */</span>
<a name="l00972"></a>00972 }
<a name="l00973"></a>00973 
<a name="l00980"></a><a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#ga7225c239e4190209e42aa449a02fd845">00980</a> <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">int</span> <a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#ga7225c239e4190209e42aa449a02fd845" title="计算指定内存地址的8位整型前导0的个数">__clz8_p</a>(<span class="keywordtype">void</span>* p)
<a name="l00981"></a>00981 {
<a name="l00982"></a>00982     <span class="keywordflow">return</span> <a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#ga0f90a0781de4ad3f8b38d62e894df9a4" title="计算8位整型前导0的个数">__clz8</a>(*((<a class="code" href="group___xE6_x95_xB4_xE5_x9E_x8B_xE5_xAE_x9A_xE4_xB9_x89.html#gae1affc9ca37cfb624959c866a73f83c2" title="8比特无符号整型">uint8_t</a>*)p));
<a name="l00983"></a>00983 }
<a name="l00984"></a>00984 
<a name="l00991"></a><a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#gabb39d770bce80fae1411bc3f8cbd1f62">00991</a> <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">int</span> <a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#gabb39d770bce80fae1411bc3f8cbd1f62" title="计算16位整型前导0的个数">__clz16</a>(uint16_t x)
<a name="l00992"></a>00992 {
<a name="l00993"></a>00993 <span class="preprocessor">#ifdef __GNUC__</span>
<a name="l00994"></a>00994 <span class="preprocessor"></span>    <span class="keywordflow">return</span> __builtin_clz((uint32_t)x) - 16;
<a name="l00995"></a>00995 <span class="preprocessor">#elif defined(_MSC_VER) &amp;&amp; _MSC_VER &gt;= 1500 </span><span class="comment">/* VS2008以上 */</span>
<a name="l00996"></a>00996     <span class="keywordflow">return</span> (<span class="keywordtype">int</span>)__lzcnt16(x);
<a name="l00997"></a>00997 <span class="preprocessor">#else</span>
<a name="l00998"></a>00998 <span class="preprocessor"></span>    <span class="keywordtype">int</span> c = 16;
<a name="l00999"></a>00999     <span class="keywordflow">if</span> (x) { --c;
<a name="l01000"></a>01000         <span class="keywordflow">if</span> (x &amp; 0xFF00) { x &amp;= 0xFF00; c -= 8; }
<a name="l01001"></a>01001         <span class="keywordflow">if</span> (x &amp; 0xF0F0) { x &amp;= 0xF0F0; c -= 4; }
<a name="l01002"></a>01002         <span class="keywordflow">if</span> (x &amp; 0xCCCC) { x &amp;= 0xCCCC; c -= 2; }
<a name="l01003"></a>01003         <span class="keywordflow">if</span> (x &amp; 0xAAAA) { x &amp;= 0xAAAA; c -= 1; }
<a name="l01004"></a>01004     }
<a name="l01005"></a>01005     <span class="keywordflow">return</span> c;
<a name="l01006"></a>01006 <span class="preprocessor">#endif </span><span class="comment">/* #ifdef __GNUC__ */</span>
<a name="l01007"></a>01007 }
<a name="l01008"></a>01008 
<a name="l01015"></a><a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#gad1ad2146255d0e7c728f8f34bc9b9c4e">01015</a> <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">int</span> <a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#gad1ad2146255d0e7c728f8f34bc9b9c4e" title="计算指定内存地址的16位整型前导0的个数">__clz16_p</a>(<span class="keywordtype">void</span>* p)
<a name="l01016"></a>01016 {
<a name="l01017"></a>01017     <span class="keywordflow">return</span> <a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#gabb39d770bce80fae1411bc3f8cbd1f62" title="计算16位整型前导0的个数">__clz16</a>(*((uint16_t*)p));
<a name="l01018"></a>01018 }
<a name="l01019"></a>01019 
<a name="l01026"></a><a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#ga10f3eeaf1b88f6e5eb1987b40ffadfb8">01026</a> <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">int</span> <a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#ga10f3eeaf1b88f6e5eb1987b40ffadfb8" title="计算32位整型前导0的个数">__clz32</a>(uint32_t x)
<a name="l01027"></a>01027 {
<a name="l01028"></a>01028 <span class="preprocessor">#ifdef __GNUC__</span>
<a name="l01029"></a>01029 <span class="preprocessor"></span>    <span class="keywordflow">return</span> __builtin_clz(x);
<a name="l01030"></a>01030 <span class="preprocessor">#elif defined(_MSC_VER) &amp;&amp; _MSC_VER &gt;= 1500 </span><span class="comment">/* VS2008以上 */</span>
<a name="l01031"></a>01031     <span class="keywordflow">return</span> (<span class="keywordtype">int</span>)__lzcnt(x);
<a name="l01032"></a>01032 <span class="preprocessor">#else</span>
<a name="l01033"></a>01033 <span class="preprocessor"></span>    <span class="keywordtype">int</span> c = 32;
<a name="l01034"></a>01034     <span class="keywordflow">if</span> (x) { --c;
<a name="l01035"></a>01035         <span class="keywordflow">if</span> (x &amp; 0xFFFF0000UL) { x &amp;= 0xFFFF0000UL; c -= 16; }
<a name="l01036"></a>01036         <span class="keywordflow">if</span> (x &amp; 0xFF00FF00UL) { x &amp;= 0xFF00FF00UL; c -=  8; }
<a name="l01037"></a>01037         <span class="keywordflow">if</span> (x &amp; 0xF0F0F0F0UL) { x &amp;= 0xF0F0F0F0UL; c -=  4; }
<a name="l01038"></a>01038         <span class="keywordflow">if</span> (x &amp; 0xCCCCCCCCUL) { x &amp;= 0xCCCCCCCCUL; c -=  2; }
<a name="l01039"></a>01039         <span class="keywordflow">if</span> (x &amp; 0xAAAAAAAAUL) { x &amp;= 0xAAAAAAAAUL; c -=  1; }
<a name="l01040"></a>01040     }
<a name="l01041"></a>01041     <span class="keywordflow">return</span> c;
<a name="l01042"></a>01042 <span class="preprocessor">#endif </span><span class="comment">/* #ifdef __GNUC__ */</span>
<a name="l01043"></a>01043 }
<a name="l01044"></a>01044 
<a name="l01051"></a><a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#ga1bd0217a8e23414e87364317f8638bbb">01051</a> <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">int</span> <a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#ga1bd0217a8e23414e87364317f8638bbb" title="计算指定内存地址的32位整型前导0的个数">__clz32_p</a>(<span class="keywordtype">void</span>* p)
<a name="l01052"></a>01052 {
<a name="l01053"></a>01053     <span class="keywordflow">return</span> <a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#ga10f3eeaf1b88f6e5eb1987b40ffadfb8" title="计算32位整型前导0的个数">__clz32</a>(*((uint32_t*)p));
<a name="l01054"></a>01054 }
<a name="l01055"></a>01055 
<a name="l01062"></a><a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#ga2b49e9473a1862eac9a078e6ae37b72c">01062</a> <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">int</span> <a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#ga2b49e9473a1862eac9a078e6ae37b72c" title="计算8位整型尾随0的个数">__ctz8</a>(<a class="code" href="group___xE6_x95_xB4_xE5_x9E_x8B_xE5_xAE_x9A_xE4_xB9_x89.html#gae1affc9ca37cfb624959c866a73f83c2" title="8比特无符号整型">uint8_t</a> x)
<a name="l01063"></a>01063 {
<a name="l01064"></a>01064 <span class="preprocessor">#ifdef __GNUC__</span>
<a name="l01065"></a>01065 <span class="preprocessor"></span>    <span class="keywordflow">return</span> __builtin_ctz((uint32_t)x);
<a name="l01066"></a>01066 <span class="preprocessor">#elif defined(_MSC_VER) &amp;&amp; _MSC_VER &gt;= 1400 </span><span class="comment">/* VS2005以上 */</span>
<a name="l01067"></a>01067     <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> _i = 0;
<a name="l01068"></a>01068     _BitScanForward(&amp;_i, (uint32_t)x);
<a name="l01069"></a>01069     <span class="keywordflow">return</span> (<span class="keywordtype">int</span>)(_i - 24);
<a name="l01070"></a>01070 <span class="preprocessor">#else</span>
<a name="l01071"></a>01071 <span class="preprocessor"></span>    <span class="keywordtype">int</span> c = 8;
<a name="l01072"></a>01072     <span class="keywordflow">if</span> (x &amp;= -((<a class="code" href="group___xE6_x95_xB4_xE5_x9E_x8B_xE5_xAE_x9A_xE4_xB9_x89.html#gae1affc9ca37cfb624959c866a73f83c2" title="8比特无符号整型">uint8_t</a>)x)) { --c;
<a name="l01073"></a>01073         <span class="keywordflow">if</span> (x &amp; 0x0F) c -=  4;
<a name="l01074"></a>01074         <span class="keywordflow">if</span> (x &amp; 0x33) c -=  2;
<a name="l01075"></a>01075         <span class="keywordflow">if</span> (x &amp; 0x55) c -=  1;
<a name="l01076"></a>01076     }
<a name="l01077"></a>01077     <span class="keywordflow">return</span> c;
<a name="l01078"></a>01078 <span class="preprocessor">#endif </span><span class="comment">/* #ifdef __GNUC__ */</span>
<a name="l01079"></a>01079 }
<a name="l01080"></a>01080 
<a name="l01087"></a><a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#ga5e38ce7dd6466cdc43569e3c578ebe07">01087</a> <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">int</span> <a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#ga5e38ce7dd6466cdc43569e3c578ebe07" title="计算指定内存地址的8位整型尾随0的个数">__ctz8_p</a>(<span class="keywordtype">void</span>* p)
<a name="l01088"></a>01088 {
<a name="l01089"></a>01089     <span class="keywordflow">return</span> <a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#ga2b49e9473a1862eac9a078e6ae37b72c" title="计算8位整型尾随0的个数">__ctz8</a>(*((<a class="code" href="group___xE6_x95_xB4_xE5_x9E_x8B_xE5_xAE_x9A_xE4_xB9_x89.html#gae1affc9ca37cfb624959c866a73f83c2" title="8比特无符号整型">uint8_t</a>*)p));
<a name="l01090"></a>01090 }
<a name="l01091"></a>01091 
<a name="l01098"></a><a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#ga2c22d5c634772899bca2845dbcfb55d3">01098</a> <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">int</span> <a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#ga2c22d5c634772899bca2845dbcfb55d3" title="计算16位整型尾随0的个数">__ctz16</a>(uint16_t x)
<a name="l01099"></a>01099 {
<a name="l01100"></a>01100 <span class="preprocessor">#ifdef __GNUC__</span>
<a name="l01101"></a>01101 <span class="preprocessor"></span>    <span class="keywordflow">return</span> __builtin_ctz((uint32_t)x);
<a name="l01102"></a>01102 <span class="preprocessor">#elif defined(_MSC_VER) &amp;&amp; _MSC_VER &gt;= 1400 </span><span class="comment">/* VS2005以上 */</span>
<a name="l01103"></a>01103     <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> _i = 0;
<a name="l01104"></a>01104     _BitScanForward(&amp;_i, (uint32_t)x);
<a name="l01105"></a>01105     <span class="keywordflow">return</span> (<span class="keywordtype">int</span>)(_i - 16);
<a name="l01106"></a>01106 <span class="preprocessor">#else</span>
<a name="l01107"></a>01107 <span class="preprocessor"></span>    <span class="keywordtype">int</span> c = 16;
<a name="l01108"></a>01108     <span class="keywordflow">if</span> (x &amp;= -((int16_t)x)) { --c;
<a name="l01109"></a>01109         <span class="keywordflow">if</span> (x &amp; 0x00FF) c -=  8;
<a name="l01110"></a>01110         <span class="keywordflow">if</span> (x &amp; 0x0F0F) c -=  4;
<a name="l01111"></a>01111         <span class="keywordflow">if</span> (x &amp; 0x3333) c -=  2;
<a name="l01112"></a>01112         <span class="keywordflow">if</span> (x &amp; 0x5555) c -=  1;
<a name="l01113"></a>01113     }
<a name="l01114"></a>01114     <span class="keywordflow">return</span> c;
<a name="l01115"></a>01115 <span class="preprocessor">#endif </span><span class="comment">/* #ifdef __GNUC__ */</span>
<a name="l01116"></a>01116 }
<a name="l01117"></a>01117 
<a name="l01124"></a><a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#gab05169be81dca6e16ec8168a1c980aeb">01124</a> <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">int</span> <a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#gab05169be81dca6e16ec8168a1c980aeb" title="计算指定内存地址的16位整型尾随0的个数">__ctz16_p</a>(<span class="keywordtype">void</span>* p)
<a name="l01125"></a>01125 {
<a name="l01126"></a>01126     <span class="keywordflow">return</span> <a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#ga2c22d5c634772899bca2845dbcfb55d3" title="计算16位整型尾随0的个数">__ctz16</a>(*((uint16_t*)p));
<a name="l01127"></a>01127 }
<a name="l01128"></a>01128 
<a name="l01135"></a><a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#ga0cf856617302c3a1ceeb5b0ca42f6843">01135</a> <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">int</span> <a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#ga0cf856617302c3a1ceeb5b0ca42f6843" title="计算32位整型尾随0的个数">__ctz32</a>(uint32_t x)
<a name="l01136"></a>01136 {
<a name="l01137"></a>01137 <span class="preprocessor">#ifdef __GNUC__</span>
<a name="l01138"></a>01138 <span class="preprocessor"></span>    <span class="keywordflow">return</span> __builtin_ctz(x);
<a name="l01139"></a>01139 <span class="preprocessor">#elif defined(_MSC_VER) &amp;&amp; _MSC_VER &gt;= 1400 </span><span class="comment">/* VS2005以上 */</span>
<a name="l01140"></a>01140     <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> _i = 0;
<a name="l01141"></a>01141     _BitScanForward(&amp;_i, x);
<a name="l01142"></a>01142     <span class="keywordflow">return</span> (<span class="keywordtype">int</span>)_i;
<a name="l01143"></a>01143 <span class="preprocessor">#else</span>
<a name="l01144"></a>01144 <span class="preprocessor"></span>    <span class="keywordtype">int</span> c = 32;
<a name="l01145"></a>01145     <span class="keywordflow">if</span> (x &amp;= -((int32_t)x)) { --c;
<a name="l01146"></a>01146         <span class="keywordflow">if</span> (x &amp; 0x0000FFFFUL) c -= 16;
<a name="l01147"></a>01147         <span class="keywordflow">if</span> (x &amp; 0x00FF00FFUL) c -=  8;
<a name="l01148"></a>01148         <span class="keywordflow">if</span> (x &amp; 0x0F0F0F0FUL) c -=  4;
<a name="l01149"></a>01149         <span class="keywordflow">if</span> (x &amp; 0x33333333UL) c -=  2;
<a name="l01150"></a>01150         <span class="keywordflow">if</span> (x &amp; 0x55555555UL) c -=  1;
<a name="l01151"></a>01151     }
<a name="l01152"></a>01152     <span class="keywordflow">return</span> c;
<a name="l01153"></a>01153 <span class="preprocessor">#endif </span><span class="comment">/* #ifdef __GNUC__ */</span>
<a name="l01154"></a>01154 }
<a name="l01155"></a>01155 
<a name="l01162"></a><a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#ga9115c4b94eb6502f393f5278972f764f">01162</a> <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">int</span> <a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#ga9115c4b94eb6502f393f5278972f764f" title="计算指定内存地址的32位整型尾随0的个数">__ctz32_p</a>(<span class="keywordtype">void</span>* p)
<a name="l01163"></a>01163 {
<a name="l01164"></a>01164     <span class="keywordflow">return</span> <a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#ga0cf856617302c3a1ceeb5b0ca42f6843" title="计算32位整型尾随0的个数">__ctz32</a>(*((uint32_t*)p));
<a name="l01165"></a>01165 }
<a name="l01166"></a>01166 
<a name="l01173"></a><a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#gacba1153b230c2e3e7cf24967d3ec0b3c">01173</a> <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">int</span> <a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#gacba1153b230c2e3e7cf24967d3ec0b3c" title="计算8位整型二进制形式含有1的个数">__popcount8</a>(<a class="code" href="group___xE6_x95_xB4_xE5_x9E_x8B_xE5_xAE_x9A_xE4_xB9_x89.html#gae1affc9ca37cfb624959c866a73f83c2" title="8比特无符号整型">uint8_t</a> x)
<a name="l01174"></a>01174 {
<a name="l01175"></a>01175     x = (x &amp; 0x55) + ((x &gt;&gt; 1) &amp; 0x55);
<a name="l01176"></a>01176     x = (x &amp; 0x33) + ((x &gt;&gt; 2) &amp; 0x33);
<a name="l01177"></a>01177     x = (x &amp; 0x0F) + ((x &gt;&gt; 4) &amp; 0x0F);
<a name="l01178"></a>01178     <span class="keywordflow">return</span> (<span class="keywordtype">int</span>)x;
<a name="l01179"></a>01179 }
<a name="l01180"></a>01180 
<a name="l01187"></a><a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#ga98b8407e24a2d92e5b833a0aed002bb9">01187</a> <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">int</span> <a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#ga98b8407e24a2d92e5b833a0aed002bb9" title="计算指定内存地址的8位整型二进制形式含有1的个数">__popcount8_p</a>(<span class="keywordtype">void</span>* p)
<a name="l01188"></a>01188 {
<a name="l01189"></a>01189     <span class="keywordflow">return</span> <a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#gacba1153b230c2e3e7cf24967d3ec0b3c" title="计算8位整型二进制形式含有1的个数">__popcount8</a>(*((<a class="code" href="group___xE6_x95_xB4_xE5_x9E_x8B_xE5_xAE_x9A_xE4_xB9_x89.html#gae1affc9ca37cfb624959c866a73f83c2" title="8比特无符号整型">uint8_t</a>*)p));
<a name="l01190"></a>01190 }
<a name="l01191"></a>01191 
<a name="l01198"></a><a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#ga6386d7f444236e4edfed8f4fab442b93">01198</a> <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">int</span> <a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#ga6386d7f444236e4edfed8f4fab442b93" title="计算16位整型二进制形式含有1的个数">__popcount16</a>(uint16_t x)
<a name="l01199"></a>01199 {
<a name="l01200"></a>01200 <span class="preprocessor">#ifdef __GNUC__</span>
<a name="l01201"></a>01201 <span class="preprocessor"></span>    <span class="keywordflow">return</span> (<span class="keywordtype">int</span>)__builtin_popcount((uint32_t)x);
<a name="l01202"></a>01202 <span class="preprocessor">#elif defined(_MSC_VER) &amp;&amp; _MSC_VER &gt;= 1500</span>
<a name="l01203"></a>01203 <span class="preprocessor"></span>    <span class="keywordflow">return</span> (<span class="keywordtype">int</span>)__popcnt16(x);
<a name="l01204"></a>01204 <span class="preprocessor">#else</span>
<a name="l01205"></a>01205 <span class="preprocessor"></span>    x = (x &amp; 0x5555) + ((x &gt;&gt; 1) &amp; 0x5555);
<a name="l01206"></a>01206     x = (x &amp; 0x3333) + ((x &gt;&gt; 2) &amp; 0x3333);
<a name="l01207"></a>01207     x = (x &amp; 0x0F0F) + ((x &gt;&gt; 4) &amp; 0x0F0F);
<a name="l01208"></a>01208     x = (x &amp; 0x00FF) + ((x &gt;&gt; 8) &amp; 0x00FF);
<a name="l01209"></a>01209     <span class="keywordflow">return</span> (<span class="keywordtype">int</span>)x;
<a name="l01210"></a>01210 <span class="preprocessor">#endif </span><span class="comment">/* #ifdef __GNUC__ */</span>
<a name="l01211"></a>01211 }
<a name="l01212"></a>01212 
<a name="l01219"></a><a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#ga2a7c6ba4a89fc343f48c33c89d56d049">01219</a> <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">int</span> <a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#ga2a7c6ba4a89fc343f48c33c89d56d049" title="计算指定内存地址的16位整型二进制形式含有1的个数">__popcount16_p</a>(<span class="keywordtype">void</span>* p)
<a name="l01220"></a>01220 {
<a name="l01221"></a>01221     <span class="keywordflow">return</span> <a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#ga6386d7f444236e4edfed8f4fab442b93" title="计算16位整型二进制形式含有1的个数">__popcount16</a>(*((uint16_t*)p));
<a name="l01222"></a>01222 }
<a name="l01223"></a>01223 
<a name="l01230"></a><a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#gadc75c2e6d0d480ecc2cb598e3dbfd9c5">01230</a> <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">int</span> <a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#gadc75c2e6d0d480ecc2cb598e3dbfd9c5" title="计算32位整型二进制形式含有1的个数">__popcount32</a>(uint32_t x)
<a name="l01231"></a>01231 {
<a name="l01232"></a>01232 <span class="preprocessor">#ifdef __GNUC__</span>
<a name="l01233"></a>01233 <span class="preprocessor"></span>    <span class="keywordflow">return</span> (<span class="keywordtype">int</span>)__builtin_popcount(x);
<a name="l01234"></a>01234 <span class="preprocessor">#elif defined(_MSC_VER) &amp;&amp; _MSC_VER &gt;= 1500</span>
<a name="l01235"></a>01235 <span class="preprocessor"></span>    <span class="keywordflow">return</span> (<span class="keywordtype">int</span>)__popcnt(x);
<a name="l01236"></a>01236 <span class="preprocessor">#else</span>
<a name="l01237"></a>01237 <span class="preprocessor"></span>    <span class="comment">/* 首先把32位分成16份，每份两个数，我们先求出每相邻两个数一共有多少个1，</span>
<a name="l01238"></a>01238 <span class="comment">     * 如此对于每一份，左边1个数是n&amp;010101...01,右边是(n&gt;&gt;1) &amp; 0101..01</span>
<a name="l01239"></a>01239 <span class="comment">     * 如此一次后，这16份每份存的都是原数中1的个数,</span>
<a name="l01240"></a>01240 <span class="comment">     * 之后16份变8份，8份变4份，直到变成1份</span>
<a name="l01241"></a>01241 <span class="comment">     */</span>
<a name="l01242"></a>01242     x = (x &amp; 0x55555555UL) + ((x &gt;&gt;  1) &amp; 0x55555555UL);
<a name="l01243"></a>01243     x = (x &amp; 0x33333333UL) + ((x &gt;&gt;  2) &amp; 0x33333333UL);
<a name="l01244"></a>01244     x = (x &amp; 0x0F0F0F0FUL) + ((x &gt;&gt;  4) &amp; 0x0F0F0F0FUL);
<a name="l01245"></a>01245     x = (x &amp; 0x00FF00FFUL) + ((x &gt;&gt;  8) &amp; 0x00FF00FFUL);
<a name="l01246"></a>01246     x = (x &amp; 0x0000FFFFUL) + ((x &gt;&gt; 16) &amp; 0x0000FFFFUL);
<a name="l01247"></a>01247     <span class="keywordflow">return</span> (<span class="keywordtype">int</span>)x;
<a name="l01248"></a>01248 <span class="preprocessor">#endif </span><span class="comment">/* #ifdef __GNUC__ */</span>
<a name="l01249"></a>01249 }
<a name="l01250"></a>01250 
<a name="l01257"></a><a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#gadccfe78fdd24493019e29096376e0547">01257</a> <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">int</span> <a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#gadccfe78fdd24493019e29096376e0547" title="计算指定内存地址的32位整型二进制形式含有1的个数">__popcount32_p</a>(<span class="keywordtype">void</span>* p)
<a name="l01258"></a>01258 {
<a name="l01259"></a>01259     <span class="keywordflow">return</span> <a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#gadc75c2e6d0d480ecc2cb598e3dbfd9c5" title="计算32位整型二进制形式含有1的个数">__popcount32</a>(*((uint32_t*)p));
<a name="l01260"></a>01260 }
<a name="l01261"></a>01261 
<a name="l01268"></a><a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#gad374a60631c8c749fe27f0ff97b38b79">01268</a> <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">int</span> <a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#gad374a60631c8c749fe27f0ff97b38b79" title="计算8位整型二进制形式有效位数目">__poprange8</a>(<a class="code" href="group___xE6_x95_xB4_xE5_x9E_x8B_xE5_xAE_x9A_xE4_xB9_x89.html#gae1affc9ca37cfb624959c866a73f83c2" title="8比特无符号整型">uint8_t</a> x)
<a name="l01269"></a>01269 {
<a name="l01270"></a>01270 <span class="preprocessor">#if defined(_MSC_VER) &amp;&amp; _MSC_VER &gt;= 1400</span>
<a name="l01271"></a>01271 <span class="preprocessor"></span>    <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> _c = 0;
<a name="l01272"></a>01272     _BitScanReverse(&amp;_c, (uint32_t)x);
<a name="l01273"></a>01273     <span class="keywordflow">return</span> (<span class="keywordtype">int</span>)_c;
<a name="l01274"></a>01274 <span class="preprocessor">#else</span>
<a name="l01275"></a>01275 <span class="preprocessor"></span>    <span class="keywordflow">return</span> (x)? 8 - (<a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#ga0f90a0781de4ad3f8b38d62e894df9a4" title="计算8位整型前导0的个数">__clz8</a>(x) + <a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#ga2b49e9473a1862eac9a078e6ae37b72c" title="计算8位整型尾随0的个数">__ctz8</a>(x)): 0;
<a name="l01276"></a>01276 <span class="preprocessor">#endif </span><span class="comment">/* #if defined(_MSC_VER) &amp;&amp; _MSC_VER &gt;= 1400 */</span>
<a name="l01277"></a>01277 }
<a name="l01278"></a>01278 
<a name="l01285"></a><a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#gaa8eff45f55261f97d0fc8a6d172e8f50">01285</a> <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">int</span> <a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#gaa8eff45f55261f97d0fc8a6d172e8f50" title="计算指定内存地址的8位整型二进制形式有效位的个数">__poprange8_p</a>(<span class="keywordtype">void</span>* p)
<a name="l01286"></a>01286 {
<a name="l01287"></a>01287     <span class="keywordflow">return</span> <a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#gad374a60631c8c749fe27f0ff97b38b79" title="计算8位整型二进制形式有效位数目">__poprange8</a>(*((<a class="code" href="group___xE6_x95_xB4_xE5_x9E_x8B_xE5_xAE_x9A_xE4_xB9_x89.html#gae1affc9ca37cfb624959c866a73f83c2" title="8比特无符号整型">uint8_t</a>*)p));
<a name="l01288"></a>01288 }
<a name="l01289"></a>01289 
<a name="l01296"></a><a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#ga131b98c455be069284d3a1dc1a4fb1fb">01296</a> <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">int</span> <a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#ga131b98c455be069284d3a1dc1a4fb1fb" title="计算16位整型二进制形式有效位数目">__poprange16</a>(uint16_t x)
<a name="l01297"></a>01297 {
<a name="l01298"></a>01298 <span class="preprocessor">#if defined(_MSC_VER) &amp;&amp; _MSC_VER &gt;= 1400</span>
<a name="l01299"></a>01299 <span class="preprocessor"></span>    <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> _c = 0;
<a name="l01300"></a>01300     _BitScanReverse(&amp;_c, (uint32_t)x);
<a name="l01301"></a>01301     <span class="keywordflow">return</span> (<span class="keywordtype">int</span>)_c;
<a name="l01302"></a>01302 <span class="preprocessor">#else</span>
<a name="l01303"></a>01303 <span class="preprocessor"></span>    <span class="keywordflow">return</span> (x)? 16 - (<a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#gabb39d770bce80fae1411bc3f8cbd1f62" title="计算16位整型前导0的个数">__clz16</a>(x) + <a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#ga2c22d5c634772899bca2845dbcfb55d3" title="计算16位整型尾随0的个数">__ctz16</a>(x)): 0;
<a name="l01304"></a>01304 <span class="preprocessor">#endif </span><span class="comment">/* #if defined(_MSC_VER) &amp;&amp; _MSC_VER &gt;= 1400 */</span>
<a name="l01305"></a>01305 }
<a name="l01306"></a>01306 
<a name="l01313"></a><a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#ga1f053b61a9476ec1ff94d7798953ff9e">01313</a> <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">int</span> <a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#ga1f053b61a9476ec1ff94d7798953ff9e" title="计算指定内存地址的16位整型二进制形式有效位的个数">__poprange16_p</a>(<span class="keywordtype">void</span>* p)
<a name="l01314"></a>01314 {
<a name="l01315"></a>01315     <span class="keywordflow">return</span> <a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#ga131b98c455be069284d3a1dc1a4fb1fb" title="计算16位整型二进制形式有效位数目">__poprange16</a>(*((uint16_t*)p));
<a name="l01316"></a>01316 }
<a name="l01317"></a>01317 
<a name="l01324"></a><a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#gaa7d2eeb360f10dd3c969767120be4033">01324</a> <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">int</span> <a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#gaa7d2eeb360f10dd3c969767120be4033" title="计算32位整型二进制形式有效位数目">__poprange32</a>(uint32_t x)
<a name="l01325"></a>01325 {
<a name="l01326"></a>01326 <span class="preprocessor">#if defined(_MSC_VER) &amp;&amp; _MSC_VER &gt;= 1400</span>
<a name="l01327"></a>01327 <span class="preprocessor"></span>    <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> _c = 0;
<a name="l01328"></a>01328     _BitScanReverse(&amp;_c, x);
<a name="l01329"></a>01329     <span class="keywordflow">return</span> (<span class="keywordtype">int</span>)_c;
<a name="l01330"></a>01330 <span class="preprocessor">#else</span>
<a name="l01331"></a>01331 <span class="preprocessor"></span>    <span class="keywordflow">return</span> (x)? 32 - (<a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#ga10f3eeaf1b88f6e5eb1987b40ffadfb8" title="计算32位整型前导0的个数">__clz32</a>(x) + <a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#ga0cf856617302c3a1ceeb5b0ca42f6843" title="计算32位整型尾随0的个数">__ctz32</a>(x)): 0;
<a name="l01332"></a>01332 <span class="preprocessor">#endif </span><span class="comment">/* #if defined(_MSC_VER) &amp;&amp; _MSC_VER &gt;= 1400 */</span>
<a name="l01333"></a>01333 }
<a name="l01334"></a>01334 
<a name="l01341"></a><a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#ga424a24fa62f4a31a5d3e906e47a69a56">01341</a> <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">int</span> <a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#ga424a24fa62f4a31a5d3e906e47a69a56" title="计算指定内存地址的32位整型二进制形式有效位的个数">__poprange32_p</a>(<span class="keywordtype">void</span>* p)
<a name="l01342"></a>01342 {
<a name="l01343"></a>01343     <span class="keywordflow">return</span> <a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#gaa7d2eeb360f10dd3c969767120be4033" title="计算32位整型二进制形式有效位数目">__poprange32</a>(*((uint32_t*)p));
<a name="l01344"></a>01344 }
<a name="l01345"></a>01345 
<a name="l01352"></a><a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#ga1f955e0d4cba6db69620730c77c1f1b1">01352</a> <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">int</span> <a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#ga1f955e0d4cba6db69620730c77c1f1b1" title="计算8位整型的奇偶校验码，即二进制形式中1的个数的模2">__parity8</a>(<a class="code" href="group___xE6_x95_xB4_xE5_x9E_x8B_xE5_xAE_x9A_xE4_xB9_x89.html#gae1affc9ca37cfb624959c866a73f83c2" title="8比特无符号整型">uint8_t</a> x)
<a name="l01353"></a>01353 {
<a name="l01354"></a>01354 <span class="preprocessor">#ifdef __GNUC__</span>
<a name="l01355"></a>01355 <span class="preprocessor"></span>    <span class="keywordflow">return</span> __builtin_parity((uint32_t)x);
<a name="l01356"></a>01356 <span class="preprocessor">#else</span>
<a name="l01357"></a>01357 <span class="preprocessor"></span>    <span class="keywordflow">return</span> <a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#gacba1153b230c2e3e7cf24967d3ec0b3c" title="计算8位整型二进制形式含有1的个数">__popcount8</a>(x) &amp; 1;
<a name="l01358"></a>01358 <span class="preprocessor">#endif </span><span class="comment">/* #ifdef __GNUC__ */</span>
<a name="l01359"></a>01359 }
<a name="l01360"></a>01360 
<a name="l01367"></a><a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#ga29aab7c31fe5d152891376e91c82ad2f">01367</a> <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">int</span> <a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#ga29aab7c31fe5d152891376e91c82ad2f" title="计算指定内存地址的8位整型的奇偶校验码，即二进制形式中1的个数的模2">__parity8_p</a>(<span class="keywordtype">void</span>* p)
<a name="l01368"></a>01368 {
<a name="l01369"></a>01369     <span class="keywordflow">return</span> <a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#ga1f955e0d4cba6db69620730c77c1f1b1" title="计算8位整型的奇偶校验码，即二进制形式中1的个数的模2">__parity8</a>(*((<a class="code" href="group___xE6_x95_xB4_xE5_x9E_x8B_xE5_xAE_x9A_xE4_xB9_x89.html#gae1affc9ca37cfb624959c866a73f83c2" title="8比特无符号整型">uint8_t</a>*)p));
<a name="l01370"></a>01370 }
<a name="l01371"></a>01371 
<a name="l01378"></a><a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#gafffadaf8eea2115fbfdbd6adc27f8979">01378</a> <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">int</span> <a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#gafffadaf8eea2115fbfdbd6adc27f8979" title="计算16位整型的奇偶校验码，即二进制形式中1的个数的模2">__parity16</a>(uint16_t x)
<a name="l01379"></a>01379 {
<a name="l01380"></a>01380 <span class="preprocessor">#ifdef __GNUC__</span>
<a name="l01381"></a>01381 <span class="preprocessor"></span>    <span class="keywordflow">return</span> __builtin_parity((uint32_t)x);
<a name="l01382"></a>01382 <span class="preprocessor">#else</span>
<a name="l01383"></a>01383 <span class="preprocessor"></span>    <span class="keywordflow">return</span> <a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#ga6386d7f444236e4edfed8f4fab442b93" title="计算16位整型二进制形式含有1的个数">__popcount16</a>(x) &amp; 1;
<a name="l01384"></a>01384 <span class="preprocessor">#endif </span><span class="comment">/* #ifdef __GNUC__ */</span>
<a name="l01385"></a>01385 }
<a name="l01386"></a>01386 
<a name="l01393"></a><a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#ga014447b0590933b9215e55a3c3d290a9">01393</a> <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">int</span> <a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#ga014447b0590933b9215e55a3c3d290a9" title="计算指定内存地址的16位整型的奇偶校验码，即二进制形式中1的个数的模2">__parity16_p</a>(<span class="keywordtype">void</span>* p)
<a name="l01394"></a>01394 {
<a name="l01395"></a>01395     <span class="keywordflow">return</span> <a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#gafffadaf8eea2115fbfdbd6adc27f8979" title="计算16位整型的奇偶校验码，即二进制形式中1的个数的模2">__parity16</a>(*((uint16_t*)p));
<a name="l01396"></a>01396 }
<a name="l01397"></a>01397 
<a name="l01404"></a><a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#ga7a237c4aa8d443fb2d533bd0a5ad9306">01404</a> <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">int</span> <a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#ga7a237c4aa8d443fb2d533bd0a5ad9306" title="计算32位整型的奇偶校验码，即二进制形式中1的个数的模2">__parity32</a>(uint32_t x)
<a name="l01405"></a>01405 {
<a name="l01406"></a>01406 <span class="preprocessor">#ifdef __GNUC__</span>
<a name="l01407"></a>01407 <span class="preprocessor"></span>    <span class="keywordflow">return</span> __builtin_parity(x);
<a name="l01408"></a>01408 <span class="preprocessor">#else</span>
<a name="l01409"></a>01409 <span class="preprocessor"></span>    <span class="keywordflow">return</span> <a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#gadc75c2e6d0d480ecc2cb598e3dbfd9c5" title="计算32位整型二进制形式含有1的个数">__popcount32</a>(x) &amp; 1;
<a name="l01410"></a>01410 <span class="preprocessor">#endif </span><span class="comment">/* #ifdef __GNUC__ */</span>
<a name="l01411"></a>01411 }
<a name="l01412"></a>01412 
<a name="l01419"></a><a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#gaedeab98be179d2bbcdd81fd0f9837200">01419</a> <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">int</span> <a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#gaedeab98be179d2bbcdd81fd0f9837200" title="计算指定内存地址的32位整型的奇偶校验码，即二进制形式中1的个数的模2">__parity32_p</a>(<span class="keywordtype">void</span>* p)
<a name="l01420"></a>01420 {
<a name="l01421"></a>01421     <span class="keywordflow">return</span> <a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#ga7a237c4aa8d443fb2d533bd0a5ad9306" title="计算32位整型的奇偶校验码，即二进制形式中1的个数的模2">__parity32</a>(*((uint32_t*)p));
<a name="l01422"></a>01422 }
<a name="l01423"></a>01423 
<a name="l01424"></a>01424 
<a name="l01425"></a>01425 <span class="comment">/* Need 64-bit integer support */</span>
<a name="l01426"></a>01426 <span class="preprocessor">#ifdef INT64_SUPPORT</span>
<a name="l01427"></a>01427 <span class="preprocessor"></span>
<a name="l01428"></a>01428 <span class="preprocessor">#define __BIT64C_L0     UINT64_C(0x0000000000000001)</span>
<a name="l01429"></a>01429 <span class="preprocessor"></span><span class="preprocessor">#define __BIT64C_L1     UINT64_C(0x0000000000000002)</span>
<a name="l01430"></a>01430 <span class="preprocessor"></span><span class="preprocessor">#define __BIT64C_L2     UINT64_C(0x0000000000000004)</span>
<a name="l01431"></a>01431 <span class="preprocessor"></span><span class="preprocessor">#define __BIT64C_L3     UINT64_C(0x0000000000000008)</span>
<a name="l01432"></a>01432 <span class="preprocessor"></span><span class="preprocessor">#define __BIT64C_L4     UINT64_C(0x0000000000000010)</span>
<a name="l01433"></a>01433 <span class="preprocessor"></span><span class="preprocessor">#define __BIT64C_L5     UINT64_C(0x0000000000000020)</span>
<a name="l01434"></a>01434 <span class="preprocessor"></span><span class="preprocessor">#define __BIT64C_L6     UINT64_C(0x0000000000000040)</span>
<a name="l01435"></a>01435 <span class="preprocessor"></span><span class="preprocessor">#define __BIT64C_L7     UINT64_C(0x0000000000000080)</span>
<a name="l01436"></a>01436 <span class="preprocessor"></span><span class="preprocessor">#define __BIT64C_L8     UINT64_C(0x0000000000000100)</span>
<a name="l01437"></a>01437 <span class="preprocessor"></span><span class="preprocessor">#define __BIT64C_L9     UINT64_C(0x0000000000000200)</span>
<a name="l01438"></a>01438 <span class="preprocessor"></span><span class="preprocessor">#define __BIT64C_L10    UINT64_C(0x0000000000000400)</span>
<a name="l01439"></a>01439 <span class="preprocessor"></span><span class="preprocessor">#define __BIT64C_L11    UINT64_C(0x0000000000000800)</span>
<a name="l01440"></a>01440 <span class="preprocessor"></span><span class="preprocessor">#define __BIT64C_L12    UINT64_C(0x0000000000001000)</span>
<a name="l01441"></a>01441 <span class="preprocessor"></span><span class="preprocessor">#define __BIT64C_L13    UINT64_C(0x0000000000002000)</span>
<a name="l01442"></a>01442 <span class="preprocessor"></span><span class="preprocessor">#define __BIT64C_L14    UINT64_C(0x0000000000004000)</span>
<a name="l01443"></a>01443 <span class="preprocessor"></span><span class="preprocessor">#define __BIT64C_L15    UINT64_C(0x0000000000008000)</span>
<a name="l01444"></a>01444 <span class="preprocessor"></span><span class="preprocessor">#define __BIT64C_L16    UINT64_C(0x0000000000010000)</span>
<a name="l01445"></a>01445 <span class="preprocessor"></span><span class="preprocessor">#define __BIT64C_L17    UINT64_C(0x0000000000020000)</span>
<a name="l01446"></a>01446 <span class="preprocessor"></span><span class="preprocessor">#define __BIT64C_L18    UINT64_C(0x0000000000040000)</span>
<a name="l01447"></a>01447 <span class="preprocessor"></span><span class="preprocessor">#define __BIT64C_L19    UINT64_C(0x0000000000080000)</span>
<a name="l01448"></a>01448 <span class="preprocessor"></span><span class="preprocessor">#define __BIT64C_L20    UINT64_C(0x0000000000100000)</span>
<a name="l01449"></a>01449 <span class="preprocessor"></span><span class="preprocessor">#define __BIT64C_L21    UINT64_C(0x0000000000200000)</span>
<a name="l01450"></a>01450 <span class="preprocessor"></span><span class="preprocessor">#define __BIT64C_L22    UINT64_C(0x0000000000400000)</span>
<a name="l01451"></a>01451 <span class="preprocessor"></span><span class="preprocessor">#define __BIT64C_L23    UINT64_C(0x0000000000800000)</span>
<a name="l01452"></a>01452 <span class="preprocessor"></span><span class="preprocessor">#define __BIT64C_L24    UINT64_C(0x0000000001000000)</span>
<a name="l01453"></a>01453 <span class="preprocessor"></span><span class="preprocessor">#define __BIT64C_L25    UINT64_C(0x0000000002000000)</span>
<a name="l01454"></a>01454 <span class="preprocessor"></span><span class="preprocessor">#define __BIT64C_L26    UINT64_C(0x0000000004000000)</span>
<a name="l01455"></a>01455 <span class="preprocessor"></span><span class="preprocessor">#define __BIT64C_L27    UINT64_C(0x0000000008000000)</span>
<a name="l01456"></a>01456 <span class="preprocessor"></span><span class="preprocessor">#define __BIT64C_L28    UINT64_C(0x0000000010000000)</span>
<a name="l01457"></a>01457 <span class="preprocessor"></span><span class="preprocessor">#define __BIT64C_L29    UINT64_C(0x0000000020000000)</span>
<a name="l01458"></a>01458 <span class="preprocessor"></span><span class="preprocessor">#define __BIT64C_L30    UINT64_C(0x0000000040000000)</span>
<a name="l01459"></a>01459 <span class="preprocessor"></span><span class="preprocessor">#define __BIT64C_L31    UINT64_C(0x0000000080000000)</span>
<a name="l01460"></a>01460 <span class="preprocessor"></span><span class="preprocessor">#define __BIT64C_L32    UINT64_C(0x0000000100000000)</span>
<a name="l01461"></a>01461 <span class="preprocessor"></span><span class="preprocessor">#define __BIT64C_L33    UINT64_C(0x0000000200000000)</span>
<a name="l01462"></a>01462 <span class="preprocessor"></span><span class="preprocessor">#define __BIT64C_L34    UINT64_C(0x0000000400000000)</span>
<a name="l01463"></a>01463 <span class="preprocessor"></span><span class="preprocessor">#define __BIT64C_L35    UINT64_C(0x0000000800000000)</span>
<a name="l01464"></a>01464 <span class="preprocessor"></span><span class="preprocessor">#define __BIT64C_L36    UINT64_C(0x0000001000000000)</span>
<a name="l01465"></a>01465 <span class="preprocessor"></span><span class="preprocessor">#define __BIT64C_L37    UINT64_C(0x0000002000000000)</span>
<a name="l01466"></a>01466 <span class="preprocessor"></span><span class="preprocessor">#define __BIT64C_L38    UINT64_C(0x0000004000000000)</span>
<a name="l01467"></a>01467 <span class="preprocessor"></span><span class="preprocessor">#define __BIT64C_L39    UINT64_C(0x0000008000000000)</span>
<a name="l01468"></a>01468 <span class="preprocessor"></span><span class="preprocessor">#define __BIT64C_L40    UINT64_C(0x0000010000000000)</span>
<a name="l01469"></a>01469 <span class="preprocessor"></span><span class="preprocessor">#define __BIT64C_L41    UINT64_C(0x0000020000000000)</span>
<a name="l01470"></a>01470 <span class="preprocessor"></span><span class="preprocessor">#define __BIT64C_L42    UINT64_C(0x0000040000000000)</span>
<a name="l01471"></a>01471 <span class="preprocessor"></span><span class="preprocessor">#define __BIT64C_L43    UINT64_C(0x0000080000000000)</span>
<a name="l01472"></a>01472 <span class="preprocessor"></span><span class="preprocessor">#define __BIT64C_L44    UINT64_C(0x0000100000000000)</span>
<a name="l01473"></a>01473 <span class="preprocessor"></span><span class="preprocessor">#define __BIT64C_L45    UINT64_C(0x0000200000000000)</span>
<a name="l01474"></a>01474 <span class="preprocessor"></span><span class="preprocessor">#define __BIT64C_L46    UINT64_C(0x0000400000000000)</span>
<a name="l01475"></a>01475 <span class="preprocessor"></span><span class="preprocessor">#define __BIT64C_L47    UINT64_C(0x0000800000000000)</span>
<a name="l01476"></a>01476 <span class="preprocessor"></span><span class="preprocessor">#define __BIT64C_L48    UINT64_C(0x0001000000000000)</span>
<a name="l01477"></a>01477 <span class="preprocessor"></span><span class="preprocessor">#define __BIT64C_L49    UINT64_C(0x0002000000000000)</span>
<a name="l01478"></a>01478 <span class="preprocessor"></span><span class="preprocessor">#define __BIT64C_L50    UINT64_C(0x0004000000000000)</span>
<a name="l01479"></a>01479 <span class="preprocessor"></span><span class="preprocessor">#define __BIT64C_L51    UINT64_C(0x0008000000000000)</span>
<a name="l01480"></a>01480 <span class="preprocessor"></span><span class="preprocessor">#define __BIT64C_L52    UINT64_C(0x0010000000000000)</span>
<a name="l01481"></a>01481 <span class="preprocessor"></span><span class="preprocessor">#define __BIT64C_L53    UINT64_C(0x0020000000000000)</span>
<a name="l01482"></a>01482 <span class="preprocessor"></span><span class="preprocessor">#define __BIT64C_L54    UINT64_C(0x0040000000000000)</span>
<a name="l01483"></a>01483 <span class="preprocessor"></span><span class="preprocessor">#define __BIT64C_L55    UINT64_C(0x0080000000000000)</span>
<a name="l01484"></a>01484 <span class="preprocessor"></span><span class="preprocessor">#define __BIT64C_L56    UINT64_C(0x0100000000000000)</span>
<a name="l01485"></a>01485 <span class="preprocessor"></span><span class="preprocessor">#define __BIT64C_L57    UINT64_C(0x0200000000000000)</span>
<a name="l01486"></a>01486 <span class="preprocessor"></span><span class="preprocessor">#define __BIT64C_L58    UINT64_C(0x0400000000000000)</span>
<a name="l01487"></a>01487 <span class="preprocessor"></span><span class="preprocessor">#define __BIT64C_L59    UINT64_C(0x0800000000000000)</span>
<a name="l01488"></a>01488 <span class="preprocessor"></span><span class="preprocessor">#define __BIT64C_L60    UINT64_C(0x1000000000000000)</span>
<a name="l01489"></a>01489 <span class="preprocessor"></span><span class="preprocessor">#define __BIT64C_L61    UINT64_C(0x2000000000000000)</span>
<a name="l01490"></a>01490 <span class="preprocessor"></span><span class="preprocessor">#define __BIT64C_L62    UINT64_C(0x4000000000000000)</span>
<a name="l01491"></a>01491 <span class="preprocessor"></span><span class="preprocessor">#define __BIT64C_L63    UINT64_C(0x8000000000000000)</span>
<a name="l01492"></a>01492 <span class="preprocessor"></span>
<a name="l01502"></a>01502 <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">int</span> __getb64(uint64_t x, <span class="keywordtype">int</span> i)
<a name="l01503"></a>01503 {
<a name="l01504"></a>01504     <span class="keywordflow">return</span> (<span class="keywordtype">int</span>)((x &gt;&gt; i) &amp; UINT64_C(1));
<a name="l01505"></a>01505 }
<a name="l01506"></a>01506 
<a name="l01516"></a>01516 <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">int</span> __getb64_p(<span class="keywordtype">void</span>* p, <span class="keywordtype">int</span> i)
<a name="l01517"></a>01517 {
<a name="l01518"></a>01518     <span class="keywordflow">return</span> (<span class="keywordtype">int</span>)((*((uint64_t*)p) &gt;&gt; i) &amp; UINT64_C(1));
<a name="l01519"></a>01519 }
<a name="l01520"></a>01520 
<a name="l01528"></a>01528 <span class="keyword">static</span> <span class="keyword">inline</span> uint64_t __setb64(uint64_t x, <span class="keywordtype">int</span> i)
<a name="l01529"></a>01529 {
<a name="l01530"></a>01530     <span class="keywordflow">return</span> x | (UINT64_C(1) &lt;&lt; i);
<a name="l01531"></a>01531 }
<a name="l01532"></a>01532 
<a name="l01540"></a>01540 <span class="keyword">static</span> <span class="keyword">inline</span> uint64_t __setb64_p(<span class="keywordtype">void</span>* p, <span class="keywordtype">int</span> i)
<a name="l01541"></a>01541 {
<a name="l01542"></a>01542     <span class="keywordflow">return</span> *((uint64_t*)p) | (UINT64_C(1) &lt;&lt; i);
<a name="l01543"></a>01543 }
<a name="l01544"></a>01544 
<a name="l01551"></a>01551 <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> __setb64_s(<span class="keywordtype">void</span>* p, <span class="keywordtype">int</span> i)
<a name="l01552"></a>01552 {
<a name="l01553"></a>01553     *((uint64_t*)p) |= (UINT64_C(1) &lt;&lt; i);
<a name="l01554"></a>01554 }
<a name="l01555"></a>01555 
<a name="l01563"></a>01563 <span class="keyword">static</span> <span class="keyword">inline</span> uint64_t __clrb64(uint64_t x, <span class="keywordtype">int</span> i)
<a name="l01564"></a>01564 {
<a name="l01565"></a>01565     <span class="keywordflow">return</span> x &amp; (~(UINT64_C(1) &lt;&lt; i));
<a name="l01566"></a>01566 }
<a name="l01567"></a>01567 
<a name="l01575"></a>01575 <span class="keyword">static</span> <span class="keyword">inline</span> uint64_t __clrb64_p(<span class="keywordtype">void</span>* p, <span class="keywordtype">int</span> i)
<a name="l01576"></a>01576 {
<a name="l01577"></a>01577     <span class="keywordflow">return</span> *((uint64_t*)p) &amp; (~(UINT64_C(1) &lt;&lt; i));
<a name="l01578"></a>01578 }
<a name="l01579"></a>01579 
<a name="l01586"></a>01586 <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> __clrb64_s(<span class="keywordtype">void</span>* p, <span class="keywordtype">int</span> i)
<a name="l01587"></a>01587 {
<a name="l01588"></a>01588     *((uint64_t*)p) &amp;= (~(UINT64_C(1) &lt;&lt; i));
<a name="l01589"></a>01589 }
<a name="l01590"></a>01590 
<a name="l01597"></a>01597 <span class="keyword">static</span> <span class="keyword">inline</span> uint64_t __to_gray64(uint64_t x)
<a name="l01598"></a>01598 {
<a name="l01599"></a>01599     <span class="keywordflow">return</span> <a class="code" href="group___xE4_xBD_x8D_xE6_x93_x8D_xE4_xBD_x9C.html#gad376b36f0a099037c4b1407d60bd0abb" title="自然码常量转格雷码常量">__to_gray_c</a>(x);
<a name="l01600"></a>01600 }
<a name="l01601"></a>01601 
<a name="l01608"></a>01608 <span class="keyword">static</span> <span class="keyword">inline</span> uint64_t __to_gray64_p(<span class="keywordtype">void</span>* p)
<a name="l01609"></a>01609 {
<a name="l01610"></a>01610     <span class="keywordflow">return</span> __to_gray64(*((uint64_t*)p));
<a name="l01611"></a>01611 }
<a name="l01612"></a>01612 
<a name="l01618"></a>01618 <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> __to_gray64_s(<span class="keywordtype">void</span>* p)
<a name="l01619"></a>01619 {
<a name="l01620"></a>01620     *((uint64_t*)p) = __to_gray64(*((uint64_t*)p));
<a name="l01621"></a>01621 }
<a name="l01622"></a>01622 
<a name="l01629"></a>01629 <span class="keyword">static</span> <span class="keyword">inline</span> uint64_t __to_natural64(uint64_t x)
<a name="l01630"></a>01630 {
<a name="l01631"></a>01631     x = x ^ (x &gt;&gt;  1);
<a name="l01632"></a>01632     x = x ^ (x &gt;&gt;  2);
<a name="l01633"></a>01633     x = x ^ (x &gt;&gt;  4);
<a name="l01634"></a>01634     x = x ^ (x &gt;&gt;  8);
<a name="l01635"></a>01635     x = x ^ (x &gt;&gt; 16);
<a name="l01636"></a>01636     x = x ^ (x &gt;&gt; 32);
<a name="l01637"></a>01637     <span class="keywordflow">return</span> x;
<a name="l01638"></a>01638 }
<a name="l01639"></a>01639 
<a name="l01646"></a>01646 <span class="keyword">static</span> <span class="keyword">inline</span> uint64_t __to_natural64_p(<span class="keywordtype">void</span>* p)
<a name="l01647"></a>01647 {
<a name="l01648"></a>01648     <span class="keywordflow">return</span> __to_natural64(*((uint64_t*)p));
<a name="l01649"></a>01649 }
<a name="l01650"></a>01650 
<a name="l01656"></a>01656 <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> __to_natural64_s(<span class="keywordtype">void</span>* p)
<a name="l01657"></a>01657 {
<a name="l01658"></a>01658     *((uint64_t*)p) = __to_natural64(*((uint64_t*)p));
<a name="l01659"></a>01659 }
<a name="l01660"></a>01660 
<a name="l01667"></a>01667 <span class="keyword">static</span> <span class="keyword">inline</span> uint64_t __flip64(uint64_t x)
<a name="l01668"></a>01668 {
<a name="l01669"></a>01669     x = ((x &gt;&gt;  1) &amp; UINT64_C(0x5555555555555555)) |
<a name="l01670"></a>01670         ((x        &amp; UINT64_C(0x5555555555555555)) &lt;&lt;  1);
<a name="l01671"></a>01671     x = ((x &gt;&gt;  2) &amp; UINT64_C(0x3333333333333333)) |
<a name="l01672"></a>01672         ((x        &amp; UINT64_C(0x3333333333333333)) &lt;&lt;  2);
<a name="l01673"></a>01673     x = ((x &gt;&gt;  4) &amp; UINT64_C(0x0F0F0F0F0F0F0F0F)) |
<a name="l01674"></a>01674         ((x        &amp; UINT64_C(0x0F0F0F0F0F0F0F0F)) &lt;&lt;  4);
<a name="l01675"></a>01675     x = ((x &gt;&gt;  8) &amp; UINT64_C(0x00FF00FF00FF00FF)) |
<a name="l01676"></a>01676         ((x        &amp; UINT64_C(0x00FF00FF00FF00FF)) &lt;&lt;  8);
<a name="l01677"></a>01677     x = ((x &gt;&gt; 16) &amp; UINT64_C(0x0000FFFF0000FFFF)) |
<a name="l01678"></a>01678         ((x        &amp; UINT64_C(0x0000FFFF0000FFFF)) &lt;&lt; 16);
<a name="l01679"></a>01679     x = (x &gt;&gt; 32) | (x &lt;&lt; 32);
<a name="l01680"></a>01680     <span class="keywordflow">return</span> x;
<a name="l01681"></a>01681 }
<a name="l01682"></a>01682 
<a name="l01689"></a>01689 <span class="keyword">static</span> <span class="keyword">inline</span> uint64_t __flip64_p(<span class="keywordtype">void</span>* p)
<a name="l01690"></a>01690 {
<a name="l01691"></a>01691     <span class="keywordflow">return</span> __flip64(*((uint64_t*)p));
<a name="l01692"></a>01692 }
<a name="l01693"></a>01693 
<a name="l01699"></a>01699 <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> __flip64_s(<span class="keywordtype">void</span>* p)
<a name="l01700"></a>01700 {
<a name="l01701"></a>01701     *((uint64_t*)p) = __flip64(*((uint64_t*)p));
<a name="l01702"></a>01702 }
<a name="l01703"></a>01703 
<a name="l01710"></a>01710 <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">int</span> __clz64(uint64_t x)
<a name="l01711"></a>01711 {
<a name="l01712"></a>01712 <span class="preprocessor">#ifdef __GNUC__</span>
<a name="l01713"></a>01713 <span class="preprocessor"></span>    <span class="keywordflow">return</span> __builtin_clzll(x);
<a name="l01714"></a>01714 <span class="preprocessor">#elif defined(_MSC_VER) &amp;&amp; _MSC_VER &gt;= 1500 </span><span class="comment">/* VS2008以上 */</span>
<a name="l01715"></a>01715     <span class="keywordflow">return</span> (<span class="keywordtype">int</span>)__lzcnt64(x);
<a name="l01716"></a>01716 <span class="preprocessor">#else</span>
<a name="l01717"></a>01717 <span class="preprocessor"></span>    <span class="keywordtype">int</span> c = 64;
<a name="l01718"></a>01718     <span class="keywordflow">if</span> (x) { --c;
<a name="l01719"></a>01719         <span class="keywordflow">if</span> (x &amp;  UINT64_C(0xFFFFFFFF00000000)) {
<a name="l01720"></a>01720             x &amp;= UINT64_C(0xFFFFFFFF00000000); c -= 32; }
<a name="l01721"></a>01721         <span class="keywordflow">if</span> (x &amp;  UINT64_C(0xFFFF0000FFFF0000)) {
<a name="l01722"></a>01722             x &amp;= UINT64_C(0xFFFF0000FFFF0000); c -= 16; }
<a name="l01723"></a>01723         <span class="keywordflow">if</span> (x &amp;  UINT64_C(0xFF00FF00FF00FF00)) {
<a name="l01724"></a>01724             x &amp;= UINT64_C(0xFF00FF00FF00FF00); c -=  8; }
<a name="l01725"></a>01725         <span class="keywordflow">if</span> (x &amp;  UINT64_C(0xF0F0F0F0F0F0F0F0)) {
<a name="l01726"></a>01726             x &amp;= UINT64_C(0xF0F0F0F0F0F0F0F0); c -=  4; }
<a name="l01727"></a>01727         <span class="keywordflow">if</span> (x &amp;  UINT64_C(0xCCCCCCCCCCCCCCCC)) {
<a name="l01728"></a>01728             x &amp;= UINT64_C(0xCCCCCCCCCCCCCCCC); c -=  2; }
<a name="l01729"></a>01729         <span class="keywordflow">if</span> (x &amp;  UINT64_C(0xAAAAAAAAAAAAAAAA)) {
<a name="l01730"></a>01730             x &amp;= UINT64_C(0xAAAAAAAAAAAAAAAA); c -=  1; }
<a name="l01731"></a>01731     }
<a name="l01732"></a>01732     <span class="keywordflow">return</span> c;
<a name="l01733"></a>01733 <span class="preprocessor">#endif </span><span class="comment">/* #ifdef __GNUC__ */</span>
<a name="l01734"></a>01734 }
<a name="l01735"></a>01735 
<a name="l01742"></a>01742 <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">int</span> __clz64_p(<span class="keywordtype">void</span>* p)
<a name="l01743"></a>01743 {
<a name="l01744"></a>01744     <span class="keywordflow">return</span> __clz64(*((uint64_t*)p));
<a name="l01745"></a>01745 }
<a name="l01746"></a>01746 
<a name="l01753"></a>01753 <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">int</span> __ctz64(uint64_t x)
<a name="l01754"></a>01754 {
<a name="l01755"></a>01755 <span class="preprocessor">#ifdef __GNUC__</span>
<a name="l01756"></a>01756 <span class="preprocessor"></span>    <span class="keywordflow">return</span> __builtin_ctzll(x);
<a name="l01757"></a>01757 <span class="preprocessor">#elif defined(_MSC_VER) &amp;&amp; _MSC_VER &gt;= 1400 </span><span class="comment">/* VS2005以上 */</span>
<a name="l01758"></a>01758     <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> _i = 0;
<a name="l01759"></a>01759     _BitScanForward64(&amp;_i, x);
<a name="l01760"></a>01760     <span class="keywordflow">return</span> (<span class="keywordtype">int</span>)_i;
<a name="l01761"></a>01761 <span class="preprocessor">#else</span>
<a name="l01762"></a>01762 <span class="preprocessor"></span>    <span class="keywordtype">int</span> c = 64;
<a name="l01763"></a>01763     <span class="keywordflow">if</span> (x &amp;= -((int64_t)x)) { --c;
<a name="l01764"></a>01764         <span class="keywordflow">if</span> (x &amp; UINT64_C(0x00000000FFFFFFFF)) c -= 32;
<a name="l01765"></a>01765         <span class="keywordflow">if</span> (x &amp; UINT64_C(0x0000FFFF0000FFFF)) c -= 16;
<a name="l01766"></a>01766         <span class="keywordflow">if</span> (x &amp; UINT64_C(0x00FF00FF00FF00FF)) c -=  8;
<a name="l01767"></a>01767         <span class="keywordflow">if</span> (x &amp; UINT64_C(0x0F0F0F0F0F0F0F0F)) c -=  4;
<a name="l01768"></a>01768         <span class="keywordflow">if</span> (x &amp; UINT64_C(0x3333333333333333)) c -=  2;
<a name="l01769"></a>01769         <span class="keywordflow">if</span> (x &amp; UINT64_C(0x5555555555555555)) c -=  1;
<a name="l01770"></a>01770     }
<a name="l01771"></a>01771     <span class="keywordflow">return</span> c;
<a name="l01772"></a>01772 <span class="preprocessor">#endif </span><span class="comment">/* #ifdef __GNUC__ */</span>
<a name="l01773"></a>01773 }
<a name="l01774"></a>01774 
<a name="l01781"></a>01781 <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">int</span> __ctz64_p(<span class="keywordtype">void</span>* p)
<a name="l01782"></a>01782 {
<a name="l01783"></a>01783     <span class="keywordflow">return</span> __ctz64(*((uint64_t*)p));
<a name="l01784"></a>01784 }
<a name="l01785"></a>01785 
<a name="l01792"></a>01792 <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">int</span> __popcount64(uint64_t x)
<a name="l01793"></a>01793 {
<a name="l01794"></a>01794 <span class="preprocessor">#ifdef __GNUC__</span>
<a name="l01795"></a>01795 <span class="preprocessor"></span>    <span class="keywordflow">return</span> (<span class="keywordtype">int</span>)__builtin_popcountll(x);
<a name="l01796"></a>01796 <span class="preprocessor">#elif defined(_MSC_VER) &amp;&amp; _MSC_VER &gt;= 1500</span>
<a name="l01797"></a>01797 <span class="preprocessor"></span>    <span class="keywordflow">return</span> (<span class="keywordtype">int</span>)__popcnt64(x);
<a name="l01798"></a>01798 <span class="preprocessor">#else</span>
<a name="l01799"></a>01799 <span class="preprocessor"></span>    x = (        x &amp; UINT64_C(0x5555555555555555)) +
<a name="l01800"></a>01800         ((x &gt;&gt;  1) &amp; UINT64_C(0x5555555555555555));
<a name="l01801"></a>01801     x = (        x &amp; UINT64_C(0x3333333333333333)) +
<a name="l01802"></a>01802         ((x &gt;&gt;  2) &amp; UINT64_C(0x3333333333333333));
<a name="l01803"></a>01803     x = (        x &amp; UINT64_C(0x0F0F0F0F0F0F0F0F)) +
<a name="l01804"></a>01804         ((x &gt;&gt;  4) &amp; UINT64_C(0x0F0F0F0F0F0F0F0F));
<a name="l01805"></a>01805     x = (        x &amp; UINT64_C(0x00FF00FF00FF00FF)) +
<a name="l01806"></a>01806         ((x &gt;&gt;  8) &amp; UINT64_C(0x00FF00FF00FF00FF));
<a name="l01807"></a>01807     x = (        x &amp; UINT64_C(0x0000FFFF0000FFFF)) +
<a name="l01808"></a>01808         ((x &gt;&gt; 16) &amp; UINT64_C(0x0000FFFF0000FFFF));
<a name="l01809"></a>01809     x = (        x &amp; UINT64_C(0x00000000FFFFFFFF)) +
<a name="l01810"></a>01810         ((x &gt;&gt; 32) &amp; UINT64_C(0x00000000FFFFFFFF));
<a name="l01811"></a>01811     <span class="keywordflow">return</span> (<span class="keywordtype">int</span>)x;
<a name="l01812"></a>01812 <span class="preprocessor">#endif </span><span class="comment">/* #ifdef __GNUC__ */</span>
<a name="l01813"></a>01813 }
<a name="l01814"></a>01814 
<a name="l01821"></a>01821 <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">int</span> __popcount64_p(<span class="keywordtype">void</span>* p)
<a name="l01822"></a>01822 {
<a name="l01823"></a>01823     <span class="keywordflow">return</span> __popcount64(*((uint64_t*)p));
<a name="l01824"></a>01824 }
<a name="l01825"></a>01825 
<a name="l01832"></a>01832 <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">int</span> __poprange64(uint64_t x)
<a name="l01833"></a>01833 {
<a name="l01834"></a>01834 <span class="preprocessor">#if defined(_MSC_VER) &amp;&amp; _MSC_VER &gt;= 1400</span>
<a name="l01835"></a>01835 <span class="preprocessor"></span>    <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> _c = 0;
<a name="l01836"></a>01836     _BitScanReverse64(&amp;_c, x);
<a name="l01837"></a>01837     <span class="keywordflow">return</span> (<span class="keywordtype">int</span>)_c;
<a name="l01838"></a>01838 <span class="preprocessor">#else</span>
<a name="l01839"></a>01839 <span class="preprocessor"></span>    <span class="keywordflow">return</span> (x)? 64 - (__clz64(x) + __ctz64(x)): 0;
<a name="l01840"></a>01840 <span class="preprocessor">#endif </span><span class="comment">/* #if defined(_MSC_VER) &amp;&amp; _MSC_VER &gt;= 1400 */</span>
<a name="l01841"></a>01841 }
<a name="l01842"></a>01842 
<a name="l01849"></a>01849 <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">int</span> __poprange64_p(<span class="keywordtype">void</span>* p)
<a name="l01850"></a>01850 {
<a name="l01851"></a>01851     <span class="keywordflow">return</span> __poprange64(*((uint64_t*)p));
<a name="l01852"></a>01852 }
<a name="l01853"></a>01853 
<a name="l01860"></a>01860 <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">int</span> __parity64(uint64_t x)
<a name="l01861"></a>01861 {
<a name="l01862"></a>01862 <span class="preprocessor">#ifdef __GNUC__</span>
<a name="l01863"></a>01863 <span class="preprocessor"></span>    <span class="keywordflow">return</span> __builtin_parityll(x);
<a name="l01864"></a>01864 <span class="preprocessor">#else</span>
<a name="l01865"></a>01865 <span class="preprocessor"></span>    <span class="keywordflow">return</span> __popcount64(x) &amp; 1;
<a name="l01866"></a>01866 <span class="preprocessor">#endif </span><span class="comment">/* #ifdef __GNUC__ */</span>
<a name="l01867"></a>01867 }
<a name="l01868"></a>01868 
<a name="l01875"></a>01875 <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">int</span> __parity64_p(<span class="keywordtype">void</span>* p)
<a name="l01876"></a>01876 {
<a name="l01877"></a>01877     <span class="keywordflow">return</span> __parity64(*((uint64_t*)p));
<a name="l01878"></a>01878 }
<a name="l01879"></a>01879 
<a name="l01880"></a>01880 <span class="preprocessor">#endif </span><span class="comment">/* #ifdef INT64_SUPPORT */</span>
<a name="l01881"></a>01881 
<a name="l01884"></a>01884 <span class="preprocessor">#ifdef __cplusplus</span>
<a name="l01885"></a>01885 <span class="preprocessor"></span>}
<a name="l01886"></a>01886 <span class="preprocessor">#endif </span><span class="comment">/* #ifdef __cplusplus */</span>
<a name="l01887"></a>01887 
<a name="l01888"></a>01888 <span class="preprocessor">#endif </span><span class="comment">/* #ifndef __NV_BITS__ */</span>
</pre></div></div>
</div>
<!--- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>全部</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>数据结构</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>文件</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>函数</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>变量</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>类型定义</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>宏定义</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<hr class="footer"/><address class="footer"><small>Generated at 2015年七月16日 星期四 12:00:38 for Navo Portable Library by&#160;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.3 </small></address>
</body>
</html>
